I used to run individual Docker containers on my server and had a script that checked for updates using `docker pull`. When it detected an update, it would rebuild the containers. Now, I've transitioned to using a Docker Compose file for better management with health checks and dependencies. I've noticed that `docker compose` has its own `pull` command, but the feedback it provides isn't as clear as `docker pull`; it doesn't tell me if an image is already up-to-date. Should I continue using `docker pull` for my images to keep my update script functional, or are there advantages to using `docker compose pull`?
2 Answers
I utilize profiles in my setup, which lets me do `docker compose --profile pull && docker compose --profile up -d`. This means I can manage multiple containers and dependencies effortlessly, especially with services like Redis, by organizing them into profiles for easier updates.
You can definitely use both methods. I usually run `docker compose pull && docker compose up -d` from the directory containing my Compose file. This way, I only update the stack when I see updates, and I have control over when to do it.
You can also just add `--pull` to your `up` command to achieve something similar without needing a separate pull step.