Change container port in docker compose

When you specified port mapping in docker you are giving 2 ports, for instance: 8082:8080. The right port is the one that is listening within the container. You can have several containers that listening internally to the same port. They are still not available in your localhost – that’s why we use the ports section for.

Now, in your localhost you cannot bind the same port more than once. That’s why docker failed when you try to set on the left side 8080 more than one time. In your current compose file, the spark service port is mapped to 8080 (left side of 8080:8080) and the webserver service is mapped to 8082 (left side of 8082:8080).

if you want to access spark, goto: http://localhost:8080 and for the web server, go to http://localhost:8082

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top