Skip to content

Instantly share code, notes, and snippets.

@mertant
Created May 7, 2025 09:06
Show Gist options
  • Select an option

  • Save mertant/e14e293df58652a08a59e95773f41198 to your computer and use it in GitHub Desktop.

Select an option

Save mertant/e14e293df58652a08a59e95773f41198 to your computer and use it in GitHub Desktop.
Docker tips

Docker & docker compose cheat sheet

Old vs. new docker compose

It was docker-compose, but that should no longer be used. It's now a built-in: docker compose.

Beware when using documentation from the web that was written for the old docker-compose, as some options which existed for the old CLI may be no longer supported in the new built-in.

Cachebusting

Force local images/cache to NOT be used:

docker build --no-cache --pull

docker compose build --pull

docker compose up --pull=always

Force local images/cache to be used, never pulling them:

docker compose up --pull=never

https://docs.docker.com/reference/cli/docker/compose/build/

https://docs.docker.com/reference/cli/docker/compose/up/

https://docs.docker.com/reference/cli/docker/buildx/build/

Troubleshooting

Macs/Apple Silicon/arm64

Recently, it seems that when pulling images on an Apple Silicon processor, Docker will sometimes default to images for the arm64 platform, which then fails with an error like the following:

ERROR: failed to solve: postgis/postgis:17-3.5: failed to resolve source metadata for docker.io/postgis/postgis:17-3.5: no match for platform in manifest: not found

The workaround for this is to specify the amd64 platform:

docker build -f Dockerfile.postgres . --platform=linux/amd64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment