From 592f8d4b1ff93779ac939da5ffec66029f375eec Mon Sep 17 00:00:00 2001 From: Jonas Hecht Date: Fri, 15 Sep 2017 11:07:45 +0200 Subject: [PATCH 1/2] Docker service registry not running correctly (Replicas 0/1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it is said in the text before "The example bind-mounts `/mnt/registry` on the swarm node to `/var/lib/registry/` within the container." the example uses a bind-mount instead of a volume-mount (see difference here in the docs: https://docs.docker.com/engine/swarm/services/#give-a-service-access-to-volumes-or-bind-mounts). As bind-mounts are only applied with `type=bind` configuration parameter of `--mount`, it has to be added here so that the `swarm-registry` service is able to start. Additionally, the bind-mount relies on the pre-existing src-directory `/mnt/registry`, which should also be added to the documentation - see important notes "If you bind mount a host path into your service’s containers, the path must exist on every swarm node." in https://docs.docker.com/engine/swarm/services/#give-a-service-access-to-volumes-or-bind-mounts. --- registry/deploying.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registry/deploying.md b/registry/deploying.md index 0e5728079d65..1b9eea4fc1ac 100644 --- a/registry/deploying.md +++ b/registry/deploying.md @@ -309,7 +309,9 @@ Next, create the service, granting it access to the two secrets and constraining it to only run on nodes with the label `registry=true`. Besides the constraint, you are also specifying that only a single replica should run at a time. The example bind-mounts `/mnt/registry` on the swarm node to `/var/lib/registry/` -within the container. +within the container. As bind-mounts rely on the pre-existing src directory, be +sure `/mnt/registry` exists on `node1` - if not, create it before running the +following `docker service create` command. By default, secrets are mounted into a service at `/run/secrets/`. @@ -319,7 +321,7 @@ $ docker service create \ --secret domain.crt \ --secret domain.key \ --label registry=true \ - --mount src=/mnt/registry,dst=/var/lib/registry \ + --mount type=bind,src=/mnt/registry,dst=/var/lib/registry \ -e REGISTRY_HTTP_ADDR=0.0.0.0:80 \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/run/secrets/domain.crt \ -e REGISTRY_HTTP_TLS_KEY=/run/secrets/domain.key \ From e51cccb95303227615dfcc18c8d05d7b82b23678 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Tue, 19 Sep 2017 09:56:42 -0700 Subject: [PATCH 2/2] Copyedits --- registry/deploying.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/deploying.md b/registry/deploying.md index db897856e536..cdb4301b7455 100644 --- a/registry/deploying.md +++ b/registry/deploying.md @@ -309,9 +309,9 @@ Next, create the service, granting it access to the two secrets and constraining it to only run on nodes with the label `registry=true`. Besides the constraint, you are also specifying that only a single replica should run at a time. The example bind-mounts `/mnt/registry` on the swarm node to `/var/lib/registry/` -within the container. As bind-mounts rely on the pre-existing source directory, -be sure `/mnt/registry` exists on `node1` - if not, create it before running the -following `docker service create` command. +within the container. Bind mounts rely on the pre-existing source directory, +so be sure `/mnt/registry` exists on `node1`. You might need to create it before +running the following `docker service create` command. By default, secrets are mounted into a service at `/run/secrets/`.