Reputation: 363
I followed several tutorials on Azure container services I ended up hitting the same problem over and over again.
Following the steps in this: https://blogs.msdn.microsoft.com/jcorioland/2016/04/25/create-a-docker-swarm-cluster-using-azure-container-service
I managed to start a container with a simple "hello world"-like application. With an SSH connection to the swarm master I confirmed that the container is running.
sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
50f5ff6bc553 nginx "nginx -g 'daemon ..." 19 minutes ago Up 19 minutes 0.0.0.0:80->80/tcp hello-nginx
15bec25756d6 swarm:1.1.0 "/swarm manage --r..." 40 minutes ago Up 39 minutes 0.0.0.0:2375->2375/tcp containers_swarm_1
f3ae3f6fda89 progrium/consul "/bin/start -serve..." 40 minutes ago Up 39 minutes 0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 53/tcp, 53/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8301-8302->8301-8302/udp containers_consul_1
curl localhost
<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
} </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>
<p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p> </body> </html>
I grabbed the public IP address of the agent load balancer and hit it on port 80.
The request takes a long time but eventually fails with 13.80.158.161 took too long to respond.
What am I doing wrong?
UPDATE:
docker node ls on the master returns the following error:
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
This is obviously the source of the issue. Not sure about the root cause or the fix yet.
Upvotes: 1
Views: 733
Reputation: 13954
According to the output of sudo docker ps -a
, it seems that you create the docker on your master, maybe you can via master public IP address to access it.
I had test it follow your offered link, here is the output of my test:
Master:
jason@swarm-master-E3E95783-0:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d744da42d16 swarm:1.1.0 "/swarm manage --r..." About an hour ago Up About an hour 0.0.0.0:2375->2375/tcp containers_swarm_1
c63107d50414 progrium/consul "/bin/start -serve..." About an hour ago Up About an hour 0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 53/tcp, 53/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8301-8302->8301-8302/udp containers_consul_1
jason@swarm-master-E3E95783-0:~$
Agent:
jason@swarm-agent-E3E95783000000:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f5b28cd76d6 nginx "nginx -g 'daemon ..." 41 minutes ago Up 41 minutes 0.0.0.0:80->80/tcp hello-nginx
jason@swarm-agent-E3E95783000000:~$
Here is the output:
jason@swarm-agent-E3E95783000000:~$ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
In your scenario, maybe you can access your master public IP address.
To access it, we should add port 80 to inbound rules to master load balancer.
Upvotes: 1