1

Is there any way to assign the public IP and specific port to the container. So the container has the public IP and Port. Some applications or other servers can access the container under the specific IP and port.

For example:
The container has an Apache Server for the 2~3 different services, Maybe one service is News service and another one if for Sell service. So we want to one publish address with the specific port like 8080 and another one is 8090, how to do?

Environment:
1.VM player
2.Centos-7
3.Docker

  • If you publish the container's port to one of the host ports (either directly or via a service), you could then access it using the host's public IP. Is this what you're looking for? – Haxiel Jan 8 at 5:14
  • @Haxiel thanks for your comment, I have pulled more information for my question, could you give me more detail messages or any reference data. – Willie Cheng Jan 8 at 6:46
  • 1
    The option I talked about is the 'publish' option offered by docker-run. Have a look at this blog as well and see if helps. – Haxiel Jan 8 at 7:21
  • @Haxiel thank you, I will try it, but I didn't see how to set up the public IP, anywhere I try it first. – Willie Cheng Jan 8 at 10:36
  • I was assuming that you were running your Docker host on a cloud of some sort. In that case, your cloud provider will typically have an option to expose the host's services using an IP that is reachable via the internet (i.e. the 'public IP'). – Haxiel Jan 8 at 15:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.