Docker Community Forums

Share and learn in the Docker community.

Creation of Swarm Service Fails

docker
beta

(Gnomff) #1

I am new to swarm, and I am trying to get a simple service set up locally. I have set up swarm discovery with consul like this:

docker-machine create -d virtualbox consul
eval $(docker-machine env consul)
docker run -d -p 8500:8500 -h consul progrium/consul -server -bootstrap
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-master
docker-machine create -d virtualbox --swarm  --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-worker
eval $(docker-machine env --swarm swarm-master)

This is all lovely, and I get the following output from docker info

Nodes: 2
swarm-master: 192.168.99.115:2376
└ ID: XRXA:2QIV:OZFX:4K3N:UF37:OWTO:TV4X:5SSE:QBGI:WDX2:ZLQS:QD7Q
└ Status: Healthy
└ Containers: 2 (2 Running, 0 Paused, 0 Stopped)
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.021 GiB
└ Labels: kernelversion=4.4.17-boot2docker, operatingsystem=Boot2Docker 1.12.1 (TCL 7.2); HEAD : ef7d0b4 - Thu Aug 18 21:18:06 UTC 2016, provider=virtualbox, storagedriver=aufs
└ UpdatedAt: 2016-08-29T21:10:51Z
└ ServerVersion: 1.12.1
swarm-worker: 192.168.99.116:2376
└ ID: BLNZ:TUGW:T4QQ:AUWZ:J7U3:JJTR:GHN2:SLCU:ZGRL:JGMM:LVOI:32DK
└ Status: Healthy
└ Containers: 1 (1 Running, 0 Paused, 0 Stopped)
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.021 GiB
└ Labels: kernelversion=4.4.17-boot2docker, operatingsystem=Boot2Docker 1.12.1 (TCL 7.2); HEAD : ef7d0b4 - Thu Aug 18 21:18:06 UTC 2016, provider=virtualbox, storagedriver=aufs
└ UpdatedAt: 2016-08-29T21:10:43Z
└ ServerVersion: 1.12.1

Hooray! And I can successfully create an overlay network

docker network create --driver overlay --subnet=10.0.9.0/24 my-network
docker network ls
NETWORK ID NAME DRIVER SCOPE
809a82c5c70d my-network overlay global

All is great! Now for the important part:

docker service create --replicas 1 --name my-web --network my-network nginx
Error response from daemon: 404 page not found

ACK! I have tried both the latest stable version of docker (1.12.0) and the latest beta version of docker (1.12.1-beta24) but I keep getting hit with this error. What have I done wrong?

OS X 10.11.6
Virtualbox 5.1.4

Steps taken from https://docs.docker.com/engine/swarm/networking/


(Gnomff) #2

I figured out the problem - I confused “swarm” with “swarm mode”


(Shettigarc1) #3

@gnomff I am new to swarm as well and stuck at exactly the same step. How did you get around this error?

docker service create --replicas 1 --name lb --network my-net1 nginx
Error response from daemon: 404 page not found

I am still trying to get my head around the swarm and swarm mode thingy.

Client:
Version: 1.12.1
API version: 1.24
Go version: go1.7.1
Git commit: 6f9534c
Built: Thu Sep 8 10:31:18 2016
OS/Arch: darwin/amd64

Server:
Version: swarm/1.2.5
API version: 1.22
Go version: go1.5.4
Git commit: 27968ed
Built: Thu Aug 18 23:10:29 UTC 2016
OS/Arch: linux/amd64