How to run docker node router on the same computer as swarm manager?

I followed these instructions to configure dockers on my Ubuntu computer. I would like to run several swarm nodes on the same computer on which the swarm manager is running, but the state of the nodes is "Expected" with the error "Unable to connect to the endpoint of the docker device."

These are the commands that I ran to configure the system:

docker run -d --name consul -p 8500:8500 progrium/consul -server -bootstrap docker run --name manager -d -p 4000:4000 swarm manage -H :4000 --advertise 192.168.1.18:4000 consul://192.168.1.18:8500 docker run -d -p 6300:2375 swarm join --advertise=192.168.1.18:6300 consul://192.168.1.18:8500 

I noticed that node is not bound to a port:

 $ nmap localhost Starting Nmap 6.40 ( http://nmap.org ) at 2016-03-02 15:06 EST Nmap scan report for localhost (127.0.0.1) Host is up (0.00054s latency). Other addresses for localhost (not scanned): 127.0.0.1 Not shown: 996 closed ports PORT STATE SERVICE 4000/tcp open remoteanything 8500/tcp open fmtp 

Information about the docker is displayed here:

 $ docker -H :4000 info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: swarm/1.1.2 Role: primary Strategy: spread Filters: health, port, dependency, affinity, constraint Nodes: 1 (unknown): 192.168.1.18:6300 β”” Status: Pending β”” Containers: 0 β”” Reserved CPUs: 0 / 0 β”” Reserved Memory: 0 B / 0 B β”” Labels: β”” Error: Cannot connect to the docker engine endpoint β”” UpdatedAt: 2016-03-02T18:44:38Z Plugins: Volume: Network: Kernel Version: 4.2.0-30-generic Operating System: linux Architecture: amd64 CPUs: 0 Total Memory: 0 B Name: 739dc6a5c721 

Any help would be greatly appreciated!

+6
source share
1 answer

It seems that now everything works after the following these instructions . To summarize, on the host computer, you should edit /etc/default/docker to include the following line:

 DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock" 

Then you must restart the docker:

 sudo restart docker 

I ran into this problem as the installer automatically starts the docker engine (at least on Ubuntu). This will cause the 3.3 command to fail ( sudo docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock ) from the moment it is run.

+3
source

All Articles