Skip to content

Latest commit

 

History

History
205 lines (137 loc) · 4.99 KB

podman-integration.md

File metadata and controls

205 lines (137 loc) · 4.99 KB

Migrating from Docker Desktop to Podman

If you already have Docker Desktop installed and need to migrate to Podman, follow these steps:

Step 1: Install Podman

First, you need to install Podman. If you're using Homebrew, you can install it with:

brew install podman

Step 2: Initialize and Start Podman Machine

Initialize and start the Podman machine:

podman machine init
podman machine start

Step 3: Uninstall Docker Desktop

  1. Open Docker Desktop.
  2. From the Docker menu, select the Troubleshoot icon.
  3. Click Uninstall.
  4. Confirm the uninstallation.

Alternatively, you can uninstall Docker Desktop from the CLI:

/Applications/Docker.app/Contents/MacOS/uninstall

After uninstalling Docker Desktop, you may want to remove residual files:

rm -rf ~/Library/Group\ Containers/group.com.docker
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/.docker

Step 4: Emulate Docker CLI Using Podman

Follow the steps here to create a script to emulate Docker CLI using Podman. This allows you to use Docker commands transparently.

Step 5: Configure Environment Variables

Set the necessary environment variables to ensure testcontainers works correctly with Podman. Add the following lines to your shell configuration file (~/.zshrc for Zsh or ~/.bashrc for Bash):

export DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export TESTCONTAINERS_RYUK_DISABLED=true

Step 6: Apply Changes

After adding the above lines to your shell configuration file, apply the changes by reloading your shell configuration:

For Zsh:

source ~/.zshrc

For Bash:

source ~/.bashrc

Step 7: Verify Environment and Run Tests

Ensure the environment variables are set and run your tests:

echo $DOCKER_HOST
echo $TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
echo $TESTCONTAINERS_RYUK_DISABLED

pnpm test

Setting Up Podman for New Team Members

If you're new to the team and need to start with Podman, follow these steps:

Step 1: Install Podman

Install Podman using Homebrew:

brew install podman

Step 2: Initialize and Start Podman Machine

Initialize and start the Podman machine:

podman machine init
podman machine start

Step 3: Emulate Docker CLI Using Podman

Follow the steps here to create a script to emulate Docker CLI using Podman. This allows you to use Docker commands transparently.

Set the necessary environment variables to ensure testcontainers works correctly with Podman. Add the following lines to your shell configuration file (~/.zshrc for Zsh or ~/.bashrc for Bash):

export DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export TESTCONTAINERS_RYUK_DISABLED=true

Step 5: Apply Changes

After adding the above lines to your shell configuration file, apply the changes by reloading your shell configuration:

For Zsh:

source ~/.zshrc

For Bash:

source ~/.bashrc

Step 6: Verify Environment and Run Tests

Ensure the environment variables are set and run your tests:

echo $DOCKER_HOST
echo $TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
echo $TESTCONTAINERS_RYUK_DISABLED

pnpm test

Optional: Troubleshooting nvm, Node.js, and pnpm Issues

If you encounter issues with nvm, node, or pnpm, follow these steps:

Issue: Commands Not Found

Step 1: Edit Your Shell Configuration File

Open your shell configuration file in a text editor. For Zsh:

nano ~/.zshrc

Or for Bash:

nano ~/.bashrc

Step 2: Add nvm Initialization

Add the following lines to ensure nvm is properly initialized upon starting a new shell session:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Step 3: Add Paths for pnpm

Add the following lines to ensure pnpm is correctly added to the PATH:

export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"

Step 4: Apply Changes

Save the file and close the editor. Apply the changes by reloading your shell configuration:

For Zsh:

source ~/.zshrc

For Bash:

source ~/.bashrc

Step 5: Verify Installations

Ensure that node, nvm, and pnpm are properly installed and accessible:

node -v
nvm -v
pnpm -v