Introduction
Port mapping in Docker Compose lets you connect your app running inside a container to your computer's network. This way, you can access the app from your browser or other tools outside the container.
When you want to run a web app inside a container and access it from your browser on your computer.
When multiple containers run on the same machine and you want to avoid port conflicts by mapping different ports.
When you need to expose a database or service running in a container to other apps on your local network.
When testing an app locally that listens on a specific port inside the container.
When sharing your app with teammates who connect to your machine's IP and port.