Connection refused for application hosted over docker swarm










0















I have a docker swarm running on 2 nodes created via Oracle VirtualBox installed on CentOS 7. I am able to deploy a stack running 6 containers equally distributed over the two machines.



However, I am unable to connect to the deployed application with ports exposed.



Here's the content of my Docker Compose File



version: "3"
services:
web:
image: <myusername>/friendlyhello:latest
deploy:
replicas: 6
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:


Here is the output of docker-machine ls:



NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.09.0
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.09.0


Here is the error from my curl command



curl http://192.168.99.100/
curl: (7) Failed connect to 192.168.99.100:80; Connection refused


Even though my application seems to be running fine.



docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
i5nw2wcir9j3 getstartedlab_web replicated 6/6 harmanspall/friendlyhello:latest *:80->80/tcp

docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
dn7mrfo1yvg4 getstartedlab_web.1 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
jxkr1psbvmpc getstartedlab_web.2 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
jttd4t6b9gz5 getstartedlab_web.3 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
zhs0c7ygj8cs getstartedlab_web.4 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
mx6gykk3qocd getstartedlab_web.5 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
pku7f60ij0bq getstartedlab_web.6 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago


My Docker network list, as seen from Swarm Manager:



NETWORK ID NAME DRIVER SCOPE
5c502a957a70 bridge bridge local
a3b1f749c09f docker_gwbridge bridge local
80nens8mmp6i getstartedlab_webnet overlay swarm
c9647a0f6c30 host host local
mj60zgzhiwjf ingress overlay swarm
5adba823ce78 none null local


Any pointers would be appreciated.



~~ EDIT ~~

This does not seem to be an issue with connectivity to VMs since I am able to ping my Virtualbox



ping 192.168.99.100 -c 5
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data.
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.246 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.215 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.226 ms
64 bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.251 ms
64 bytes from 192.168.99.100: icmp_seq=5 ttl=64 time=0.262 ms

--- 192.168.99.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.215/0.240/0.262/0.017 ms


It also fails when I try curl from inside the VM



docker-machine ssh myvm1 "curl http://192.168.99.100/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
exit status 7

docker-machine ssh myvm1 "curl http://localhost/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
exit status 7









share|improve this question
























  • docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

    – Markus
    Nov 13 '18 at 13:18











  • How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

    – Ilyas Deckers
    Nov 13 '18 at 13:23











  • @Markus I just added the info.

    – Harman
    Nov 13 '18 at 13:27











  • @IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

    – Harman
    Nov 13 '18 at 13:28












  • does your image <myusername>/friendlyhello:latest expose the port?

    – Siyu
    Nov 13 '18 at 14:35















0















I have a docker swarm running on 2 nodes created via Oracle VirtualBox installed on CentOS 7. I am able to deploy a stack running 6 containers equally distributed over the two machines.



However, I am unable to connect to the deployed application with ports exposed.



Here's the content of my Docker Compose File



version: "3"
services:
web:
image: <myusername>/friendlyhello:latest
deploy:
replicas: 6
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:


Here is the output of docker-machine ls:



NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.09.0
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.09.0


Here is the error from my curl command



curl http://192.168.99.100/
curl: (7) Failed connect to 192.168.99.100:80; Connection refused


Even though my application seems to be running fine.



docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
i5nw2wcir9j3 getstartedlab_web replicated 6/6 harmanspall/friendlyhello:latest *:80->80/tcp

docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
dn7mrfo1yvg4 getstartedlab_web.1 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
jxkr1psbvmpc getstartedlab_web.2 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
jttd4t6b9gz5 getstartedlab_web.3 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
zhs0c7ygj8cs getstartedlab_web.4 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
mx6gykk3qocd getstartedlab_web.5 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
pku7f60ij0bq getstartedlab_web.6 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago


My Docker network list, as seen from Swarm Manager:



NETWORK ID NAME DRIVER SCOPE
5c502a957a70 bridge bridge local
a3b1f749c09f docker_gwbridge bridge local
80nens8mmp6i getstartedlab_webnet overlay swarm
c9647a0f6c30 host host local
mj60zgzhiwjf ingress overlay swarm
5adba823ce78 none null local


Any pointers would be appreciated.



~~ EDIT ~~

This does not seem to be an issue with connectivity to VMs since I am able to ping my Virtualbox



ping 192.168.99.100 -c 5
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data.
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.246 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.215 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.226 ms
64 bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.251 ms
64 bytes from 192.168.99.100: icmp_seq=5 ttl=64 time=0.262 ms

--- 192.168.99.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.215/0.240/0.262/0.017 ms


It also fails when I try curl from inside the VM



docker-machine ssh myvm1 "curl http://192.168.99.100/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
exit status 7

docker-machine ssh myvm1 "curl http://localhost/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
exit status 7









share|improve this question
























  • docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

    – Markus
    Nov 13 '18 at 13:18











  • How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

    – Ilyas Deckers
    Nov 13 '18 at 13:23











  • @Markus I just added the info.

    – Harman
    Nov 13 '18 at 13:27











  • @IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

    – Harman
    Nov 13 '18 at 13:28












  • does your image <myusername>/friendlyhello:latest expose the port?

    – Siyu
    Nov 13 '18 at 14:35













0












0








0








I have a docker swarm running on 2 nodes created via Oracle VirtualBox installed on CentOS 7. I am able to deploy a stack running 6 containers equally distributed over the two machines.



However, I am unable to connect to the deployed application with ports exposed.



Here's the content of my Docker Compose File



version: "3"
services:
web:
image: <myusername>/friendlyhello:latest
deploy:
replicas: 6
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:


Here is the output of docker-machine ls:



NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.09.0
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.09.0


Here is the error from my curl command



curl http://192.168.99.100/
curl: (7) Failed connect to 192.168.99.100:80; Connection refused


Even though my application seems to be running fine.



docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
i5nw2wcir9j3 getstartedlab_web replicated 6/6 harmanspall/friendlyhello:latest *:80->80/tcp

docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
dn7mrfo1yvg4 getstartedlab_web.1 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
jxkr1psbvmpc getstartedlab_web.2 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
jttd4t6b9gz5 getstartedlab_web.3 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
zhs0c7ygj8cs getstartedlab_web.4 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
mx6gykk3qocd getstartedlab_web.5 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
pku7f60ij0bq getstartedlab_web.6 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago


My Docker network list, as seen from Swarm Manager:



NETWORK ID NAME DRIVER SCOPE
5c502a957a70 bridge bridge local
a3b1f749c09f docker_gwbridge bridge local
80nens8mmp6i getstartedlab_webnet overlay swarm
c9647a0f6c30 host host local
mj60zgzhiwjf ingress overlay swarm
5adba823ce78 none null local


Any pointers would be appreciated.



~~ EDIT ~~

This does not seem to be an issue with connectivity to VMs since I am able to ping my Virtualbox



ping 192.168.99.100 -c 5
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data.
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.246 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.215 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.226 ms
64 bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.251 ms
64 bytes from 192.168.99.100: icmp_seq=5 ttl=64 time=0.262 ms

--- 192.168.99.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.215/0.240/0.262/0.017 ms


It also fails when I try curl from inside the VM



docker-machine ssh myvm1 "curl http://192.168.99.100/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
exit status 7

docker-machine ssh myvm1 "curl http://localhost/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
exit status 7









share|improve this question
















I have a docker swarm running on 2 nodes created via Oracle VirtualBox installed on CentOS 7. I am able to deploy a stack running 6 containers equally distributed over the two machines.



However, I am unable to connect to the deployed application with ports exposed.



Here's the content of my Docker Compose File



version: "3"
services:
web:
image: <myusername>/friendlyhello:latest
deploy:
replicas: 6
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:


Here is the output of docker-machine ls:



NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.09.0
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.09.0


Here is the error from my curl command



curl http://192.168.99.100/
curl: (7) Failed connect to 192.168.99.100:80; Connection refused


Even though my application seems to be running fine.



docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
i5nw2wcir9j3 getstartedlab_web replicated 6/6 harmanspall/friendlyhello:latest *:80->80/tcp

docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
dn7mrfo1yvg4 getstartedlab_web.1 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
jxkr1psbvmpc getstartedlab_web.2 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
jttd4t6b9gz5 getstartedlab_web.3 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
zhs0c7ygj8cs getstartedlab_web.4 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
mx6gykk3qocd getstartedlab_web.5 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
pku7f60ij0bq getstartedlab_web.6 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago


My Docker network list, as seen from Swarm Manager:



NETWORK ID NAME DRIVER SCOPE
5c502a957a70 bridge bridge local
a3b1f749c09f docker_gwbridge bridge local
80nens8mmp6i getstartedlab_webnet overlay swarm
c9647a0f6c30 host host local
mj60zgzhiwjf ingress overlay swarm
5adba823ce78 none null local


Any pointers would be appreciated.



~~ EDIT ~~

This does not seem to be an issue with connectivity to VMs since I am able to ping my Virtualbox



ping 192.168.99.100 -c 5
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data.
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.246 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.215 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.226 ms
64 bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.251 ms
64 bytes from 192.168.99.100: icmp_seq=5 ttl=64 time=0.262 ms

--- 192.168.99.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.215/0.240/0.262/0.017 ms


It also fails when I try curl from inside the VM



docker-machine ssh myvm1 "curl http://192.168.99.100/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
exit status 7

docker-machine ssh myvm1 "curl http://localhost/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
exit status 7






docker virtualbox docker-swarm docker-swarm-mode






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 14:10







Harman

















asked Nov 13 '18 at 13:09









HarmanHarman

5361526




5361526












  • docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

    – Markus
    Nov 13 '18 at 13:18











  • How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

    – Ilyas Deckers
    Nov 13 '18 at 13:23











  • @Markus I just added the info.

    – Harman
    Nov 13 '18 at 13:27











  • @IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

    – Harman
    Nov 13 '18 at 13:28












  • does your image <myusername>/friendlyhello:latest expose the port?

    – Siyu
    Nov 13 '18 at 14:35

















  • docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

    – Markus
    Nov 13 '18 at 13:18











  • How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

    – Ilyas Deckers
    Nov 13 '18 at 13:23











  • @Markus I just added the info.

    – Harman
    Nov 13 '18 at 13:27











  • @IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

    – Harman
    Nov 13 '18 at 13:28












  • does your image <myusername>/friendlyhello:latest expose the port?

    – Siyu
    Nov 13 '18 at 14:35
















docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

– Markus
Nov 13 '18 at 13:18





docker-machine ls only shows that there are two VMs running where your containers could run. You should give us the output of "docker service ps" tells more about the deployed services' state.

– Markus
Nov 13 '18 at 13:18













How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

– Ilyas Deckers
Nov 13 '18 at 13:23





How is networking configured in virtualbox? Can you ping the two VM's? My guess is that you have NAT configured in Virtualbox. You should try to switch to bridged.

– Ilyas Deckers
Nov 13 '18 at 13:23













@Markus I just added the info.

– Harman
Nov 13 '18 at 13:27





@Markus I just added the info.

– Harman
Nov 13 '18 at 13:27













@IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

– Harman
Nov 13 '18 at 13:28






@IlyasDeckers It's bridged, I believe. Posted in the original thread. I actually tried to use curl from inside the Virtualbox too and the results was same. And ping to Virtualbox succeeds.

– Harman
Nov 13 '18 at 13:28














does your image <myusername>/friendlyhello:latest expose the port?

– Siyu
Nov 13 '18 at 14:35





does your image <myusername>/friendlyhello:latest expose the port?

– Siyu
Nov 13 '18 at 14:35












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281720%2fconnection-refused-for-application-hosted-over-docker-swarm%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 Stack Overflow!


  • 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%2fstackoverflow.com%2fquestions%2f53281720%2fconnection-refused-for-application-hosted-over-docker-swarm%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







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto