Webserver in docker container is not reachable via the internetPostfix in Docker container not forwarding...
NASA's RS-25 Engines shut down time
UART pins to unpowered MCU?
Contract Factories
Is it "Vierergruppe" or "Viergruppe", or is there a distinction?
Difference on montgomery curve equation between EFD and RFC7748
Am I not good enough for you?
What wound would be of little consequence to a biped but terrible for a quadruped?
Should I tell my boss the work he did was worthless
Reverse string, can I make it faster?
Can I pump my MTB tire to max (55 psi / 380 kPa) without the tube inside bursting?
Motivation for Zeta Function of an Algebraic Variety
Should I take out a loan for a friend to invest on my behalf?
What are some noteworthy "mic-drop" moments in math?
Conservation of Mass and Energy
Good for you! in Russian
Latex does not go to next line
Does "Until when" sound natural for native speakers?
How can I ensure my trip to the UK will not have to be cancelled because of Brexit?
In the quantum hamiltonian, why does kinetic energy turn into an operator while potential doesn't?
Dropdown com clique
How to draw cubes in a 3 dimensional plane
Are tamper resistant receptacles really safer?
weren't playing vs didn't play
Word for a person who has no opinion about whether god exists
Webserver in docker container is not reachable via the internet
Postfix in Docker container not forwarding virtual aliasesDocker: how to link host to container with the “link” option?Forward ssh connections to docker container by hostnameDoes Docker's CAP_NET_ADMIN allow a container to affect the host network, or only it's own?Mixed Riak cluster with docker container instances and non-container instancesBrowser services' container in Docker Swarm modeHAProxy 1.7 not resolving docker 1.13.1 containerTwo NICs docker host, fixed container source IP, no connection to second subnetDocker networking IPv6 exposedwhy sendmail in container not working when running on different host machines?
I've been reading: https://docs.docker.com/engine/userguide/networking/#user-defined-networks
I've created my own network (docker network create --driver bridge devils_network
):
441be50f3792 bridge bridge local
0d73f7c6fe00 devils_network bridge local
8e189dda9fef host host local
5ebca4a1e514 none null local
I run the container so:
docker run -it -d -v ~/dockervolume/deus:/srv/www --name deus --hostname deus --network=devils_network -p 80:8080 karl/node
And in the dockerfile expose port 8080:
EXPOSE 8080
I've attached a terminal session to the container and inspected the container to make sure the webserver is up and running:
root 17 0.0 0.1 4508 660 ? S 22:46 0:00 sh -c NODE_PATH="$(pwd)" NODE_ENV=production node hello_world
root 19 0.0 4.3 882896 22004 ? Sl 22:46 0:00 node hello_world
The webserver is utilizing port 8080 inside the docker container.
I'm running on a DigitalOcean droplet. If I start the server up directly on the host and not via a docker container it works.
docker
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've been reading: https://docs.docker.com/engine/userguide/networking/#user-defined-networks
I've created my own network (docker network create --driver bridge devils_network
):
441be50f3792 bridge bridge local
0d73f7c6fe00 devils_network bridge local
8e189dda9fef host host local
5ebca4a1e514 none null local
I run the container so:
docker run -it -d -v ~/dockervolume/deus:/srv/www --name deus --hostname deus --network=devils_network -p 80:8080 karl/node
And in the dockerfile expose port 8080:
EXPOSE 8080
I've attached a terminal session to the container and inspected the container to make sure the webserver is up and running:
root 17 0.0 0.1 4508 660 ? S 22:46 0:00 sh -c NODE_PATH="$(pwd)" NODE_ENV=production node hello_world
root 19 0.0 4.3 882896 22004 ? Sl 22:46 0:00 node hello_world
The webserver is utilizing port 8080 inside the docker container.
I'm running on a DigitalOcean droplet. If I start the server up directly on the host and not via a docker container it works.
docker
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've been reading: https://docs.docker.com/engine/userguide/networking/#user-defined-networks
I've created my own network (docker network create --driver bridge devils_network
):
441be50f3792 bridge bridge local
0d73f7c6fe00 devils_network bridge local
8e189dda9fef host host local
5ebca4a1e514 none null local
I run the container so:
docker run -it -d -v ~/dockervolume/deus:/srv/www --name deus --hostname deus --network=devils_network -p 80:8080 karl/node
And in the dockerfile expose port 8080:
EXPOSE 8080
I've attached a terminal session to the container and inspected the container to make sure the webserver is up and running:
root 17 0.0 0.1 4508 660 ? S 22:46 0:00 sh -c NODE_PATH="$(pwd)" NODE_ENV=production node hello_world
root 19 0.0 4.3 882896 22004 ? Sl 22:46 0:00 node hello_world
The webserver is utilizing port 8080 inside the docker container.
I'm running on a DigitalOcean droplet. If I start the server up directly on the host and not via a docker container it works.
docker
I've been reading: https://docs.docker.com/engine/userguide/networking/#user-defined-networks
I've created my own network (docker network create --driver bridge devils_network
):
441be50f3792 bridge bridge local
0d73f7c6fe00 devils_network bridge local
8e189dda9fef host host local
5ebca4a1e514 none null local
I run the container so:
docker run -it -d -v ~/dockervolume/deus:/srv/www --name deus --hostname deus --network=devils_network -p 80:8080 karl/node
And in the dockerfile expose port 8080:
EXPOSE 8080
I've attached a terminal session to the container and inspected the container to make sure the webserver is up and running:
root 17 0.0 0.1 4508 660 ? S 22:46 0:00 sh -c NODE_PATH="$(pwd)" NODE_ENV=production node hello_world
root 19 0.0 4.3 882896 22004 ? Sl 22:46 0:00 node hello_world
The webserver is utilizing port 8080 inside the docker container.
I'm running on a DigitalOcean droplet. If I start the server up directly on the host and not via a docker container it works.
docker
docker
edited Aug 16 '17 at 7:14
Karl Morrison
asked Aug 15 '17 at 23:09
Karl MorrisonKarl Morrison
55221033
55221033
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
- You need to inverse the mapping -p 80:8080 to -p 8080:80 The 1st
port is on the host and the second is the container's. - On your work/home network, make sure to redirect, in your router/fw, the port 8080 to your docker host port 8080.
This should work:
Here is the same steps I performed with my nginx container:
docker network create --driver bridge devils_network
4320854ef67c5489848c1e1f14ffaf4d65183c5e3fac5f655c038bb15aa50df7
docker run -it -v ~/dockervolume/deus:/usr/share/nginx/html --name deus --hostname deus --network=devils_network -p 8080:80 ajnouri/nginx
root@deus:/#
Copied an index.php file into ~/dockervolume/deus:
And browsed my public IP from my phone:
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
add a comment |
Derp. I was using the following before in my Node.js application:
const hostname = '127.0.0.1';
const port = 8080;
I changed it to:
const hostname = '0.0.0.0';
const port = 8080;
Now it's working. The reason I used 127.0.0.1
is because I'm so used to using a reverse proxy (HAProxy) to deal with this. However I want the docker container to directly connect to the internet and not go through a reverse proxy.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f868837%2fwebserver-in-docker-container-is-not-reachable-via-the-internet%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
- You need to inverse the mapping -p 80:8080 to -p 8080:80 The 1st
port is on the host and the second is the container's. - On your work/home network, make sure to redirect, in your router/fw, the port 8080 to your docker host port 8080.
This should work:
Here is the same steps I performed with my nginx container:
docker network create --driver bridge devils_network
4320854ef67c5489848c1e1f14ffaf4d65183c5e3fac5f655c038bb15aa50df7
docker run -it -v ~/dockervolume/deus:/usr/share/nginx/html --name deus --hostname deus --network=devils_network -p 8080:80 ajnouri/nginx
root@deus:/#
Copied an index.php file into ~/dockervolume/deus:
And browsed my public IP from my phone:
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
add a comment |
- You need to inverse the mapping -p 80:8080 to -p 8080:80 The 1st
port is on the host and the second is the container's. - On your work/home network, make sure to redirect, in your router/fw, the port 8080 to your docker host port 8080.
This should work:
Here is the same steps I performed with my nginx container:
docker network create --driver bridge devils_network
4320854ef67c5489848c1e1f14ffaf4d65183c5e3fac5f655c038bb15aa50df7
docker run -it -v ~/dockervolume/deus:/usr/share/nginx/html --name deus --hostname deus --network=devils_network -p 8080:80 ajnouri/nginx
root@deus:/#
Copied an index.php file into ~/dockervolume/deus:
And browsed my public IP from my phone:
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
add a comment |
- You need to inverse the mapping -p 80:8080 to -p 8080:80 The 1st
port is on the host and the second is the container's. - On your work/home network, make sure to redirect, in your router/fw, the port 8080 to your docker host port 8080.
This should work:
Here is the same steps I performed with my nginx container:
docker network create --driver bridge devils_network
4320854ef67c5489848c1e1f14ffaf4d65183c5e3fac5f655c038bb15aa50df7
docker run -it -v ~/dockervolume/deus:/usr/share/nginx/html --name deus --hostname deus --network=devils_network -p 8080:80 ajnouri/nginx
root@deus:/#
Copied an index.php file into ~/dockervolume/deus:
And browsed my public IP from my phone:
- You need to inverse the mapping -p 80:8080 to -p 8080:80 The 1st
port is on the host and the second is the container's. - On your work/home network, make sure to redirect, in your router/fw, the port 8080 to your docker host port 8080.
This should work:
Here is the same steps I performed with my nginx container:
docker network create --driver bridge devils_network
4320854ef67c5489848c1e1f14ffaf4d65183c5e3fac5f655c038bb15aa50df7
docker run -it -v ~/dockervolume/deus:/usr/share/nginx/html --name deus --hostname deus --network=devils_network -p 8080:80 ajnouri/nginx
root@deus:/#
Copied an index.php file into ~/dockervolume/deus:
And browsed my public IP from my phone:
edited Aug 16 '17 at 0:51
answered Aug 16 '17 at 0:45
AJNAJN
247210
247210
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
add a comment |
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
Hi man! Thanks for the answer, I just realized I left out some important information regarding my question. The webserver is utilizing port 8080 inside the container. So I need to map hosts port 80 to the containers port 8080. Also running on DigitalOcean.
– Karl Morrison
Aug 16 '17 at 7:18
add a comment |
Derp. I was using the following before in my Node.js application:
const hostname = '127.0.0.1';
const port = 8080;
I changed it to:
const hostname = '0.0.0.0';
const port = 8080;
Now it's working. The reason I used 127.0.0.1
is because I'm so used to using a reverse proxy (HAProxy) to deal with this. However I want the docker container to directly connect to the internet and not go through a reverse proxy.
add a comment |
Derp. I was using the following before in my Node.js application:
const hostname = '127.0.0.1';
const port = 8080;
I changed it to:
const hostname = '0.0.0.0';
const port = 8080;
Now it's working. The reason I used 127.0.0.1
is because I'm so used to using a reverse proxy (HAProxy) to deal with this. However I want the docker container to directly connect to the internet and not go through a reverse proxy.
add a comment |
Derp. I was using the following before in my Node.js application:
const hostname = '127.0.0.1';
const port = 8080;
I changed it to:
const hostname = '0.0.0.0';
const port = 8080;
Now it's working. The reason I used 127.0.0.1
is because I'm so used to using a reverse proxy (HAProxy) to deal with this. However I want the docker container to directly connect to the internet and not go through a reverse proxy.
Derp. I was using the following before in my Node.js application:
const hostname = '127.0.0.1';
const port = 8080;
I changed it to:
const hostname = '0.0.0.0';
const port = 8080;
Now it's working. The reason I used 127.0.0.1
is because I'm so used to using a reverse proxy (HAProxy) to deal with this. However I want the docker container to directly connect to the internet and not go through a reverse proxy.
edited Aug 17 '17 at 20:17
answered Aug 16 '17 at 17:02
Karl MorrisonKarl Morrison
55221033
55221033
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f868837%2fwebserver-in-docker-container-is-not-reachable-via-the-internet%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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