docker-compose
Browse all articles, tutorials, and guides about docker-compose
Posts
docker compose: Always Recreate Containers from Fresh Images
Run docker compose up -d --pull always --build --force-recreate to pull newer images, rebuild local ones and replace containers instead of reusing them.
Connecting to PostgreSQL in a Docker Container from Outside
Expose PostgreSQL safely and connect from your host or another machine using Docker and Docker Compose. Covers port publishing, listen addresses, pg_hba.conf basics, and common troubleshooting.
What Is the Difference Between 'docker compose' and 'docker-compose'?
Confused about 'docker compose' vs 'docker-compose'? Learn the key differences, why the new command exists, and which one you should use for your projects.
How Can I Use Environment Variables in docker-compose?
Learn the best ways to manage and use environment variables in docker-compose files, including .env files, variable substitution, and secure practices for real-world projects.
How to Use docker-compose up for Only Certain Containers
Want to start just a few services from your docker-compose file? Learn how to use docker-compose up to run only specific containers, with practical examples and tips for multi-service projects.
How to Add a Volume to an Existing Docker Container
You cannot change mounts on a running container, but you can safely recreate it with the desired volume. This guide shows exact commands for Docker CLI and Docker Compose, plus ways to migrate or seed data.
What’s the Difference Between Docker Compose vs. Dockerfile?
Understand the key differences between Docker Compose and Dockerfile, and learn when to use each in your containerized workflows.
Docker Compose: Wait for Container X Before Starting Y
Configure Docker Compose so a service waits for another container to be ready, using healthchecks and depends_on conditions with a working example.
Docker Compose: Understanding Ports vs Expose
Learn the key differences between ports and expose in Docker Compose, when to use each one, and how they affect container networking and security in your applications.
Communication Between Multiple Docker-Compose Projects
Learn how to enable communication between multiple Docker-Compose projects using shared networks and environment configurations.
How to Execute Multiple Commands in Docker Compose
Learn different techniques for running multiple commands in Docker Compose services, from simple command chaining to advanced multi-stage initialization scripts.
How to Rebuild, Restart and Upgrade a Docker Compose Container
restart, up -d, up --build and --force-recreate each apply a different kind of change, and only one of them rebuilds your image. Tested on Compose 5.6: which command picks up code, config and image changes, how to upgrade without losing data, how to get a shell in a running or crashed service, and a Compose 2.38 quirk that can leave old code running.