Docker Compose Tip #81: tty and stdin_open for interactive containers

Drop a bash or python service into a compose.yaml and it exits immediately on up. The container starts, sees no stdin, prints nothing, and stops. The fix is the Compose equivalent of docker run -it: tty: true and stdin_open: true. What each flag does The two flags map directly to the docker run flags everyone has typed a thousand times: stdin_open: true ⇔ docker run -i — keep STDIN open even when not attached. tty: true ⇔ docker run -t — allocate a pseudo-TTY. services: shell: image: alpine command: sh stdin_open: true tty: true Set both for an interactive shell. Set only tty: true for a process that wants a terminal (for color output, line-buffered logs) but doesn’t read from stdin. stdin_open: true alone is rare — almost always paired with tty. ...

June 26, 2026 · 3 min · 610 words · Guillaume Lours

Docker Compose Tip #76: docker compose down and its options

docker compose down looks like a tidy shutdown command. It is, but the flags around it decide whether you walk away with your data intact, with a clean image store, or with a database wiped because you typed -v out of habit. The default behavior Without any flag, down stops and removes: Every container in the project The default network Compose created for the project Anonymous volumes that the stack was using It does not remove: ...

June 15, 2026 · 3 min · 606 words · Guillaume Lours

Docker Compose Tip #74: docker compose ls and cross-project visibility

docker compose ps shows the services inside the current project. docker compose ls zooms out: every Compose stack running anywhere on the host, regardless of which directory you happen to be standing in. The basics Run it from any directory: docker compose ls Sample output: NAME STATUS CONFIG FILES api-platform running(4) /home/dev/api-platform/compose.yaml data-pipeline running(2) /home/dev/data-pipeline/compose.yaml old-prototype exited(3) /tmp/prototype/compose.yaml Three columns: the project name, how many services are up, and the path to the Compose file that started it. No need to cd into the project to see what’s running. ...

June 10, 2026 · 3 min · 492 words · Guillaume Lours

Docker Compose Tip #73: expose vs ports — what actually gets published

Two directives that look similar but do completely different things. Confusing expose with ports is a classic way to either break inter-service communication or accidentally publish a database to the public internet. What each one does ports publishes a container port to the host. The outside world (and anything on the host) can reach it. services: web: image: nginx ports: - "8080:80" # host:container expose declares that a container listens on a port. It does not publish anything to the host. The directive is documentation of intent for tooling and humans. ...

June 8, 2026 · 3 min · 508 words · Guillaume Lours

Docker Compose Tip #64: Copying files with docker compose cp

Need to grab a log file out of a container? Push a quick config change for a one-off test? Don’t redeploy with a bind mount, just use docker compose cp. Basic usage The syntax mirrors docker cp but resolves service names instead of container IDs: # Copy from container to host docker compose cp <service>:<container-path> <host-path> # Copy from host to container docker compose cp <host-path> <service>:<container-path> The direction is determined by which side has the service: prefix. ...

May 18, 2026 · 2 min · 351 words · Guillaume Lours