Podman
Podman
Podman is an alterative runtime to docker & can now operate as a replacement for docker desktop on Windows & Mac. This will explore the Docker Desktop to podman transition.
Mac
Install with brew
brew install podman
Basic commands
Initialize VM containers will run inside. This is a one time setup command.
podman machine init
To start and stop the VM container environment, run the below commands.
podman machine start
podman machine stop
Stop container VM
podman machine stop
Run Hello World
podman run --rm hello-world
Trying to pull hello-world:latest...
Getting image source signatures
Copying blob sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54
Copying blob sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54
Copying config sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
Writing manifest to image destination
Storing signatures
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Transitioning from Docker CLI & Docker Compose
The first convenience step is to alias the docker cli command to Podman. Podman is cli compatable with docker, so this should work in most cases to allow your existing scripts & tools to use Podman rather than docker.
If you want to set an alias in your terminal session, run and/or put this alias into your . profile file such as .bashrc or .zshrc.
alias docker=podman
I have found this generally works for a terminal session, but for use with scripts which may not run using those profile files, it can be useful to set an symbolic link to the podman executable. This will make the docker command available to even scripts that don’t source your profile files.
ln -s /usr/local/bin/podman /usr/local/bin/docker
Next, if you use docker compose regularly, follow these steps to use podman with Docker Compose.
Install Podman Compose, an alterative to docker compose implemented with rootless Podman.
pip3 install podman-compose
Similar to the docker cli aliases, you can create aliases for docker-compose with the alias command or by symbolic link
alias docker-compose=podman-compose
ln -s $(which podman-compose) /usr/local/bin/docker-compose
Issues / Looking Forward
I saw a few issues while testing podman / podman-compose to replace docker & docker-compose.
- Mouting Shared folders does not have first class support (https://github.com/containers/podman/issues/8016)
- Docker Compose multiple app logging (currently returns Error: logs does not support multiple containers when run remotely)
I think these issues are generally minor / being actively resolved. Using Podman is certainly more effort that using Docker Desktop, but is a viable alterative.
Windows
TBD