Can You See Docker CLI Commands From Docker Compose?

April 17, 2025 5 answers
Asked by glider.tow.line
I'm curious if there's a way to see all the equivalent Docker CLI commands that get executed when running `docker-compose up` or `docker-compose down`. If that's not possible, it seems like a useful feature to help users better understand both the Docker CLI and Docker Compose. What do you all think?

Answers

rhubarb+8
Docker Compose sends commands to the Docker service, rather than directly executing bash commands. If you want the equivalent bash commands that `docker-compose` runs, it might be tough, but you can get insights by examining the source code. However, trying to translate everything might only lead to approximations, so reading the code or documentation could be more practical for understanding.

seed_18mm: I get that, but some people might find it overwhelming to jump straight into the code. Documentation could be a better starting point for most!

Reply to this answer
crumbs everywhere
Using bash scripts alongside Docker Compose is very common. Typically, you'll write your scripts using `docker compose` commands for simplicity. Still, there are times when you might need to rely on the CLI for creating things like external networks or volumes that don't tie into your Compose project directly.
Reply to this answer
starfield_2deg
If you're looking for a tool that converts your Docker Compose file into `docker run` commands, check out this site: [Decomposerize](https://www.decomposerize.com). It's handy, especially if you use a different container tool like Podman, which translates better from the Docker commands.
Reply to this answer
!+chowder night
For learning purposes, using cheat sheets can really be beneficial. Plus, if you search for "dockerize" and "composerize," you might find websites that help translate between the two!
Reply to this answer
shrug and retry
Docker Compose operates using the Docker API just like the Docker CLI. It's often easier to learn Docker concepts with Compose since it abstracts a lot of complexity. Most users typically use Docker CLI commands for debugging or temporary tasks instead of everything manual.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions