What is the difference between `-p 80:80` and `-p 127.0.0.1:80:80`?
BeginnerConceptNetworking
Answer
The first binds on all host interfaces (0.0.0.0, and often :: too), exposing the service to the network. The second binds only to loopback, reachable just from the host (or via a reverse proxy/SSH tunnel). For databases and admin UIs always bind to 127.0.0.1.
More on Networking
What network drivers does Docker have?BeginnerHow does the default bridge network work?AdvancedDefault bridge vs user-defined bridge: what is the difference?IntermediateHow does container DNS work?IntermediateHow does `-p 8080:80` work under the hood?AdvancedHow does `--network host` work and what are the trade-offs?Intermediate