Reputation: 2882
Is it possible to set a different host port than the container's exposed port in docker? For example docker run -name some_container -p 80:8080 -i -t some_img
If so, is it -p host:container
or -p container:host
? I've looked through the docs and haven't found any examples of this nor details on the publish option for docker run
.
Additionally, I don't want to use the same port as the container because that is where Kubernete's api-server is listening.
Upvotes: 0
Views: 111
Reputation: 687
Yes you can map any host port to container port unless it is being used by other application
docker run -p 80:8080 --name=centos centos:latest
it is host:container format.
Upvotes: 0
Reputation: 10877
It is host:container and it is possible to set different port on the host. This Link has some good examples.
Upvotes: 1