Publish ports on all interfaces. The ports are then accessible from "outside" unless the firewall blocks traffic.
$ docker run -p 80:80 nginx
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
16f16f77fc90 nginx "/docker-entrypoint.…" 10 seconds ago Up 9 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp dreamy_neumann
$ ss -t -n state listening 'sport :80'
Recv-Q Send-Q Local Address:Port Peer Address:Port Process
0 4096 0.0.0.0:80 0.0.0.0:*
0 4096 [::]:80 [::]:*
Publish ports on the local interface. The ports are not accessible from the "outside".
$ docker run -p 127.0.0.1:80:80 -p "[::1]:80:80" nginx
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
756ad0e6f0d8 nginx "/docker-entrypoint.…" 30 seconds ago Up 30 seconds 127.0.0.1:80->80/tcp busy_diffie
$ ss -t -n state listening 'sport :80'
Recv-Q Send-Q Local Address:Port Peer Address:Port Process
0 4096 127.0.0.1:80 0.0.0.0:*
0 4096 [::1]:80 [::]:*