Should I use ‘docker pull’ or ‘docker compose pull’ for my stack updates?

0
0
Asked By TechWhiz23 On

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

Answered By MultiProfileMaster On

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.

Answered By DockerDude42 On

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.

StackSavvy88 -

You can also just add `--pull` to your `up` command to achieve something similar without needing a separate pull step.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.