podman
Using from macOS
Section titled Using from macOS🚨🚨 ATTENTION 🚨🚨 I never got this working, or at least not easily. There were too many moving parts for me to follow what was going on, so I eventually switched to Docker Desktop.
Note that podman
is “Linux-first”, so using it on macOS isn’t the easiest thing. I think that Podman Desktop makes it easier, at least.
- Install with
brew install podman
- Note that
podman-compose
is apparently not as usable asdocker-compose
, so you should installdocker-compose
from the latest Git release:curl -L https://github.com/docker/compose/releases/download/v2.23.3/docker-compose-darwin-aarch64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Running PostgreSQL
Section titled Running PostgreSQL- Save as
compose.yml
:
version: "3.8"services: db: image: postgres:16.1 restart: always # This is only needed on macOS since the database files are owned by your # macOS user, not the Postgres user. # user: "${UID}:${GID}" environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: bar POSTGRES_DB: foo volumes: - $HOME/tmp/delete_me:/var/lib/postgresql/data ports: - 5432:5432
The bit about the user:
block:
- If you get “Operation not permitted”, then it’s almost certainly because of directory permissions and which user is being used to create the database.
- On macOS, the database files will be owned by the macOS user, not the Postgres user. If you were to do
docker-compose up
with that file withuser:
commented out, you’ll create the database folder with your own user. However, Postgres needs it to be the Postgres user, so you would need to do something like this:sudo chown -R 100998:100998 $HOME/tmp/postgres
(where100998
is the ID of the Postgres user).