CentOs-7 environment --How to setup the public IP(ex:124.108.103.103) and specific port (ex:8080~8090)on the Docker container

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












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










share|improve this question
























  • 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















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










share|improve this question
























  • 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













1












1








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










share|improve this question
















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







centos docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 9 at 1:19







Willie Cheng

















asked Jan 8 at 2:57









Willie ChengWillie Cheng

1216




1216












  • 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

















  • 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
















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





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





@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




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






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





@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





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










0






active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493134%2fcentos-7-environment-how-to-setup-the-public-ipex124-108-103-103-and-specif%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493134%2fcentos-7-environment-how-to-setup-the-public-ipex124-108-103-103-and-specif%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?