Skip to content

Commit e92b849

Browse files
authored
Merge pull request #70 from wmbutler/patch-1
Update README.md
2 parents 8e6c9fd + e43cf1f commit e92b849

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

README.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ With watchtower you can update the running version of your containerized app sim
1313

1414
For example, let's say you were running watchtower along with an instance of *centurylink/wetty-cli* image:
1515

16-
```
16+
```bash
1717
$ docker ps
1818
CONTAINER ID IMAGE STATUS PORTS NAMES
1919
967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080->3000/tcp wetty
@@ -30,7 +30,7 @@ Since the watchtower code needs to interact with the Docker API in order to moni
3030

3131
Run the `watchtower` container with the following command:
3232

33-
```
33+
```bash
3434
docker run -d \
3535
--name watchtower \
3636
-v /var/run/docker.sock:/var/run/docker.sock \
@@ -40,19 +40,37 @@ docker run -d \
4040
If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS`
4141
or by mounting the host's docker config file into the container (at the root of the container filesystem `/`).
4242

43-
```
43+
```bash
4444
docker run -d \
4545
--name watchtower \
4646
-v /home/<user>/.docker/config.json:/config.json \
4747
-v /var/run/docker.sock:/var/run/docker.sock \
4848
drud/watchtower container_to_watch --debug
4949
```
5050

51+
If you mount the config file as described below, be sure to also prepend the url for the registry when starting up your watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container from a private repo at dockerhub and monitors it with watchtower. Note the command argument changing the interval to 30s rather than the default 5 minutes.
52+
53+
```json
54+
version: "3"
55+
services:
56+
cavo:
57+
image: index.docker.io/<org>/<image>:<tag>
58+
ports:
59+
- "443:3443"
60+
- "80:3080"
61+
watchtower:
62+
image: v2tec/watchtower
63+
volumes:
64+
- /var/run/docker.sock:/var/run/docker.sock
65+
- /root/.docker/config.json:/config.json
66+
command: --interval 30
67+
```
68+
5169
### Arguments
5270

5371
By default, watchtower will monitor all containers running within the Docker daemon to which it is pointed (in most cases this will be the local Docker daemon, but you can override it with the `--host` option described in the next section). However, you can restrict watchtower to monitoring a subset of the running containers by specifying the container names as arguments when launching watchtower.
5472

55-
```
73+
```bash
5674
docker run -d \
5775
--name watchtower \
5876
-v /var/run/docker.sock:/var/run/docker.sock \
@@ -67,7 +85,7 @@ When no arguments are specified, watchtower will monitor all running containers.
6785

6886
Any of the options described below can be passed to the watchtower process by setting them after the image name in the `docker run` string:
6987

70-
```
88+
```bash
7189
docker run --rm v2tec/watchtower --help
7290
```
7391

@@ -93,29 +111,29 @@ If your container should be shutdown with a different signal you can communicate
93111

94112
This label can be coded directly into your image by using the `LABEL` instruction in your Dockerfile:
95113

96-
```
114+
```docker
97115
LABEL com.centurylinklabs.watchtower.stop-signal="SIGHUP"
98116
```
99117

100118
Or, it can be specified as part of the `docker run` command line:
101119

102-
```
120+
```bash
103121
docker run -d --label=com.centurylinklabs.watchtower.stop-signal=SIGHUP someimage
104122
```
105123

106124
## Remote Hosts
107125

108126
By default, watchtower is set-up to monitor the local Docker daemon (the same daemon running the watchtower container itself). However, it is possible to configure watchtower to monitor a remote Docker endpoint. When starting the watchtower container you can specify a remote Docker endpoint with either the `--host` flag or the `DOCKER_HOST` environment variable:
109127

110-
```
128+
```bash
111129
docker run -d \
112130
--name watchtower \
113131
v2tec/watchtower --host "tcp://10.0.1.2:2375"
114132
```
115133

116134
or
117135

118-
```
136+
```bash
119137
docker run -d \
120138
--name watchtower \
121139
-e DOCKER_HOST="tcp://10.0.1.2:2375" \
@@ -132,7 +150,7 @@ The *docker-machine* certificates for a particular host can be located by execut
132150

133151
With the certificates mounted into the watchtower container you need to specify the `--tlsverify` flag to enable verification of the certificate:
134152

135-
```
153+
```bash
136154
docker run -d \
137155
--name watchtower \
138156
-e DOCKER_HOST=$DOCKER_HOST \

0 commit comments

Comments
 (0)