Reputation: 10672
How to bind all ports in docker to their corresponding ports on host?
The -p
option requires to manually specify each exposed port and its corresponding host port:
docker run -p 4568:4568
The -P
option binds all ports, but to random ports on host.
Is there an option like -P
that binds all ports to the same port on host?
Upvotes: 0
Views: 610
Reputation: 2502
You can create run_me.sh script that will do "docker run" with all required parameters and port mappings.
#!/bin/bash
docker run --rm \
--name container-name \
-p 8080:80 \
-p 8443:443 \
-i image-name-here
Upvotes: 1