A Brief Primer on Docker Networking Rules: EXPOSE, -p, -P, –link

Docker Networking Rules

If you’ve built any multi-container applications, chances are you’ve had to define some networking rules in order to allow traffic between your containers. There are several ways to do this: you can expose a port via the --expose flag at runtime, or include an EXPOSE instruction in the Dockerfile. You can also publish ports by using the -p or -P flags in the Docker run string. There’s also container linking via --link. While these may achieve mostly the same results, they are different. So which one should you use?…

http://www.centurylinklabs.com/docker-networking-rules/