[Docker Cloud System Image] Automatically redeploys services when new images are pushed
The Docker Cloud Continuous Deployment service (dockercloud/cd-daemon or "CD
service") automatically redeploys labeled services on a swarm when a new image
is pushed to the service's source repository in the Cloud Registry. The service
runs as a system container on one of the swarm's manager nodes. The manager does
not need to be the manager leader, as other managers forward requests to the
manager running the CD daemon.
Note: The Continuous Deployment service requires Docker v1.13 or later to run.
When running, the service periodically polls the swarm to create a list of services that are labeled for redeploy, and which also originate from repositories on Docker Cloud. The CD service then monitors the services' source repositories in Docker Cloud for push events. When a push event is detected, the CD service redeploys the service using the updated image.
To enable continuous deployment:
Using your shell or terminal, connect to a manager node on the swarm.
Tip: If you are installing the CD service on a swarm that is registered with Docker Cloud, you can connect using the command displayed when you click the swarm's name.
While connected to a manager node, run the following command to pull and install the CD service system container.
$ docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock dockercloud/cd
This command prompts you for your Docker ID credentials, but you can also run the container in non-interactive mode if you want to pass your credentials as variables or in the command itself:
```
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_USER=<yourdockerid> -e DOCKER_PASS=<password> dockercloud/cd
```
The manager pulls and runs a system container which performs CD management tasks on one of the swarm managers. All managers can run the CD service, but only one manager runs it at a time and other managers forward requests. If the designated manager fails, a the swarm choses a new manager to run the CD container.
Next, Label the services you want to redeploy.
Next, label the services that you want to automatically redeploy using the CD service. You can apply this label to as many, or as few services as you want on your swarm. Because you are applying the label at the service level, all containers in a service inherit the label; you do not need to modify individual container labels.
You can either:
Once a service is marked for redeploy, the CD service finds the Docker Cloud
repository the service was created from, and listens for new docker push
events to that repository. When a new image is pushed to the Docker Cloud
repository, the CD service then redeploys the service on the swarm using the
updated image.
To add the CD label to existing services, use the service update command in the docker-cloud CLI tool.
$ docker service update --label-add com.docker.cloud.redeploy=true SERVICE_NAME
To apply the CD label to a new service, add --label com.docker.cloud.redeploy=true to the service create command you use.
For example:
$ docker service create --name my_web nginx --label com.docker.cloud.redeploy=true
| Envvar | Description |
|---|---|
| DEBUG | print debug log, if set |
| DOCKER_USER | username of Docker ID |
| DOCKER_PASS | password of Docker ID |
| POLLING_INTERVAL | polling interval in second, default 60 |
Content type
Image
Digest
Size
6.3 MB
Last updated
over 9 years ago
docker pull dockercloud/cd