Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
moschlar committed Nov 20, 2023
1 parent 30ef12a commit a4b7a4e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
76 changes: 41 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@ A Docker swarm service for automatically updating your services whenever their b

## Usage

docker service create --name shepherd \
--constraint "node.role==manager" \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro \
containrrr/shepherd
```shell-script
docker service create --name shepherd \
--constraint "node.role==manager" \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro \
containrrr/shepherd
```

### Or with Docker Compose

version: "3"
services:
...
shepherd:
build: .
image: containrrr/shepherd
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
placement:
constraints:
- node.role == manager
```yaml
version: "3"
services:
...
shepherd:
build: .
image: containrrr/shepherd
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
placement:
constraints:
- node.role == manager
```
See the example [docker-compose.yml](docker-compose.yml) and some more compose configs in the [examples](examples) folder.
Expand Down Expand Up @@ -64,7 +68,7 @@ Create and edit that file locally, eg at the location `private/shepherd-registri
docker secret create shepherd-registries-auth private/shepherd-registries-auth
```
You need to make the secret available to shepherd with the `secrets` key, and pass the secret file to the `REGISTRIES_FILE` variable:
```
```yaml
services:
app:
image: containrrr/shepherd
Expand All @@ -78,7 +82,7 @@ secrets:
```
You also need to add a label `shepherd.auth.config` to the container to be updated specifying which line of the secret file should be used. The value of that label should be the `id` in the secret file:

```
```yaml
deploy:
labels:
- shepherd.enable=true
Expand All @@ -99,23 +103,25 @@ If you care about log entries having the right timezone, you can set the `TZ` va

Example:

docker service create --name shepherd \
--constraint "node.role==manager" \
--env SLEEP_TIME="5m" \
--env IGNORELIST_SERVICES="shepherd my-other-service" \
--env WITH_REGISTRY_AUTH="true" \
--env WITH_INSECURE_REGISTRY="true" \
--env WITH_NO_RESOLVE_IMAGE="true" \
--env FILTER_SERVICES="label=com.mydomain.autodeploy" \
--env APPRISE_SIDECAR_URL="apprise-microservice:5000" \
--env IMAGE_AUTOCLEAN_LIMIT="5" \
--env RUN_ONCE_AND_EXIT="true" \
--env ROLLBACK_ON_FAILURE="true" \
--env UPDATE_OPTIONS="--update-delay=30s" \
--env TZ=Europe/Berlin \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro \
--mount type=bind,source=/root/.docker/config.json,target=/root/.docker/config.json,ro \
containrrr/shepherd
```shell-script
docker service create --name shepherd \
--constraint "node.role==manager" \
--env SLEEP_TIME="5m" \
--env IGNORELIST_SERVICES="shepherd my-other-service" \
--env WITH_REGISTRY_AUTH="true" \
--env WITH_INSECURE_REGISTRY="true" \
--env WITH_NO_RESOLVE_IMAGE="true" \
--env FILTER_SERVICES="label=com.mydomain.autodeploy" \
--env APPRISE_SIDECAR_URL="apprise-microservice:5000" \
--env IMAGE_AUTOCLEAN_LIMIT="5" \
--env RUN_ONCE_AND_EXIT="true" \
--env ROLLBACK_ON_FAILURE="true" \
--env UPDATE_OPTIONS="--update-delay=30s" \
--env TZ=Europe/Berlin \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro \
--mount type=bind,source=/root/.docker/config.json,target=/root/.docker/config.json,ro \
containrrr/shepherd
```

*Note that the quotes in the command above are evaluated by your shell and are not part of the environment variable value! - See also the note in [docker-compose.yml](docker-compose.yml)!*

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ services:
deploy:
placement:
constraints:
- node.role == manager
- node.role == manager
2 changes: 1 addition & 1 deletion examples/docker-compose.swarm-cronjob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- swarm.cronjob.skip-running=true
placement:
constraints:
- node.role == manager
- node.role == manager

scheduler:
image: crazymax/swarm-cronjob:latest
Expand Down

0 comments on commit a4b7a4e

Please sign in to comment.