The Shortest Path to Replace Docker with Podman for “Laravel Sail”
First of all, this article is written for “Laravel Sail” users. And this idea is valid for both MacOS and Windows, but I will focus on MacOS.
If you need to use docker
on MacOS or Windows for your work in the company, simply you have 2 options. One is to use Docker Desktop
by paying a license fee (Team plan starting at $9/user/month), and the other is to use a free alternative.
If you prefer the second option, you could try podman. The shortest path is here.
1. (optional) Uninstall Docker Desktop
if it is already installed. Don’t forget to delete ~/.docker
directory, too.
2. Install podman
and docker-compose
brew install podman
brew install docker-compose
3. Start podman
podman machine init
podman machine set --rootful
podman machine start
4. Edit your ~/.bashrc (in my case, ~/.zshrc) to define an alias docker
and save it
# goto alias section and add this
docker=podman
5. Apply your changes
source ~/.zshrc
6. Test docker
$ docker --version
podman version 4.4.2
7. Add this config into your .env
to avoid “Docker is not running” error when you execute sail up
SAIL_SKIP_CHECKS=true
Done. It’s time to sail with podman!
Now you can try sail up
. If you want to rebuild containers, then run sail up --build
.
Troubleshooting
Error “Updates for this repository will not be applied” during “sail up”
When you experience the error like below:
#0 19.45 E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease is not valid yet (invalid for another 6min 25s). Updates for this repository will not be applied.
Solution: Restarting podman to fix time-sync.
podman machine stop
podman machine start
sail up
Cannot connect to the Docker daemon at unix:///Users/your-username/.local/share/containers/podman/machine/podman-machine-default/podman.sock. Is the docker daemon running?
You need to edit your shell rc file (for me, it’s ~/.zshrc) to edit path for `DOCKER_HOST`, you can get the valid path when you run `podman machine start`, please use it.
export DOCKER_HOST='unix:///Users/katombo/.local/share/containers/podman/machine/qemu/podman.sock'
After update DOCKER_HOST, don’t forget to run source path-to-your shell rc file
source ~/.zshrc