Interview Prep/Docker/Docker Compose

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.

All Docker questions Roadmap: Docker & containers

More on Docker Compose