What is the difference between `ports` and `expose` in Compose?
BeginnerConceptDocker Compose
Answer
ports publishes to the host ("8080:80"). expose only documents a port for linked services; the container is reachable by other containers on the network anyway. For internal-only services, publish nothing.
More on Docker Compose
What is Docker Compose and what problem does it solve?Beginner`docker-compose` vs `docker compose`?BeginnerShow a minimal Compose file with a web app and a database.BeginnerWhat does `depends_on` guarantee?IntermediateHow do containers in Compose reach each other?BeginnerHow does Compose choose the project name and why does it matter?Intermediate