If you already have Docker Desktop installed and need to migrate to Podman, follow these steps:
First, you need to install Podman. If you're using Homebrew, you can install it with:
brew install podman
Initialize and start the Podman machine:
podman machine init
podman machine start
- Open Docker Desktop.
- From the Docker menu, select the Troubleshoot icon.
- Click Uninstall.
- 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
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
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
Ensure the environment variables are set and run your tests:
echo $DOCKER_HOST
echo $TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
echo $TESTCONTAINERS_RYUK_DISABLED
pnpm test
If you're new to the team and need to start with Podman, follow these steps:
Install Podman using Homebrew:
brew install podman
Initialize and start the Podman machine:
podman machine init
podman machine start
Follow the steps here to create a script to emulate Docker CLI using Podman. This allows you to use Docker commands transparently.
Step 4: Set 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
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
Ensure the environment variables are set and run your tests:
echo $DOCKER_HOST
echo $TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
echo $TESTCONTAINERS_RYUK_DISABLED
pnpm test
If you encounter issues with nvm, node, or pnpm, follow these steps:
Open your shell configuration file in a text editor. For Zsh:
nano ~/.zshrc
Or for Bash:
nano ~/.bashrc
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
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"
Save the file and close the editor. Apply the changes by reloading your shell configuration:
For Zsh:
source ~/.zshrc
For Bash:
source ~/.bashrc
Ensure that node, nvm, and pnpm are properly installed and accessible:
node -v
nvm -v
pnpm -v