Removed comments in Dockerfile, v2tec → kopfkrieg

This commit is contained in:
KopfKrieg 2019-01-27 18:54:05 +01:00
parent 66c768d821
commit 45bb2f97fc
5 changed files with 31 additions and 45 deletions

View file

@ -1,26 +1,7 @@
## ##
## Alpine image to get some needed data # Build
## ##
#FROM alpine:latest as alpine FROM golang:alpine as build-env
#RUN apk add --no-cache \
# ca-certificates \
# tzdata
#
##
## Image
##
#FROM scratch
#LABEL "com.centurylinklabs.watchtower"="true"
#
## copy files from other containers
#COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
#COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
#
#COPY watchtower /
#ENTRYPOINT ["/watchtower"]
# build stage
FROM golang:alpine AS build-env
RUN apk add --no-cache openssh-client git curl RUN apk add --no-cache openssh-client git curl
@ -37,7 +18,9 @@ RUN glide install
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o watchtower . RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o watchtower .
# RUN go build -o watchtower . # RUN go build -o watchtower .
# final stage ##
# Watchtower
##
FROM alpine FROM alpine
LABEL "com.centurylinklabs.watchtower"="true" LABEL "com.centurylinklabs.watchtower"="true"

View file

@ -1,9 +1,9 @@
# Watchtower # Watchtower
[![Circle CI](https://circleci.com/gh/v2tec/watchtower.svg?style=shield)](https://circleci.com/gh/v2tec/watchtower) [![Circle CI](https://circleci.com/gh/kopfkrieg/watchtower.svg?style=shield)](https://circleci.com/gh/kopfkrieg/watchtower)
[![GoDoc](https://godoc.org/github.com/v2tec/watchtower?status.svg)](https://godoc.org/github.com/v2tec/watchtower) [![GoDoc](https://godoc.org/github.com/kopfkrieg/watchtower?status.svg)](https://godoc.org/github.com/kopfkrieg/watchtower)
[![](https://images.microbadger.com/badges/image/v2tec/watchtower.svg)](https://microbadger.com/images/v2tec/watchtower "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/image/kopfkrieg/watchtower.svg)](https://microbadger.com/images/kopfkrieg/watchtower "Get your own image badge on microbadger.com")
[![Go Report Card](https://goreportcard.com/badge/github.com/v2tec/watchtower)](https://goreportcard.com/report/github.com/v2tec/watchtower) [![Go Report Card](https://goreportcard.com/badge/github.com/kopfkrieg/watchtower)](https://goreportcard.com/report/github.com/kopfkrieg/watchtower)
A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed. A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed.
@ -19,14 +19,14 @@ For example, let's say you were running watchtower along with an instance of *ce
$ docker ps $ docker ps
CONTAINER ID IMAGE STATUS PORTS NAMES CONTAINER ID IMAGE STATUS PORTS NAMES
967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080->3000/tcp wetty 967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080->3000/tcp wetty
6cc4d2a9d1a5 v2tec/watchtower Up 15 minutes watchtower 6cc4d2a9d1a5 kopfkrieg/watchtower Up 15 minutes watchtower
``` ```
Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same `docker run` options that were used to start the container initially (in this case, that would include the `-p 8080:3000` port mapping). Every few minutes watchtower will pull the latest *centurylink/wetty-cli* image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same `docker run` options that were used to start the container initially (in this case, that would include the `-p 8080:3000` port mapping).
## Usage ## Usage
Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `v2tec/watchtower` image. Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `kopfkrieg/watchtower` image.
Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount */var/run/docker.sock* into the container with the -v flag when you run it. Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount */var/run/docker.sock* into the container with the -v flag when you run it.
@ -36,7 +36,7 @@ Run the `watchtower` container with the following command:
docker run -d \ docker run -d \
--name watchtower \ --name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
v2tec/watchtower kopfkrieg/watchtower
``` ```
If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS` If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS`
@ -47,7 +47,7 @@ docker run -d \
--name watchtower \ --name watchtower \
-v /home/<user>/.docker/config.json:/config.json \ -v /home/<user>/.docker/config.json:/config.json \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
v2tec/watchtower container_to_watch --debug kopfkrieg/watchtower container_to_watch --debug
``` ```
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. 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.
@ -61,7 +61,7 @@ services:
- "443:3443" - "443:3443"
- "80:3080" - "80:3080"
watchtower: watchtower:
image: v2tec/watchtower image: kopfkrieg/watchtower
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- /root/.docker/config.json:/config.json - /root/.docker/config.json:/config.json
@ -76,7 +76,7 @@ By default, watchtower will monitor all containers running within the Docker dae
docker run -d \ docker run -d \
--name watchtower \ --name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
v2tec/watchtower nginx redis kopfkrieg/watchtower nginx redis
``` ```
In the example above, watchtower will only monitor the containers named "nginx" and "redis" for updates -- all of the other running containers will be ignored. In the example above, watchtower will only monitor the containers named "nginx" and "redis" for updates -- all of the other running containers will be ignored.
@ -88,7 +88,7 @@ When no arguments are specified, watchtower will monitor all running containers.
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: 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:
```bash ```bash
docker run --rm v2tec/watchtower --help docker run --rm kopfkrieg/watchtower --help
``` ```
* `--host, -h` Docker daemon socket to connect to. Defaults to "unix:///var/run/docker.sock" but can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port". The host value can also be provided by setting the `DOCKER_HOST` environment variable. * `--host, -h` Docker daemon socket to connect to. Defaults to "unix:///var/run/docker.sock" but can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port". The host value can also be provided by setting the `DOCKER_HOST` environment variable.
@ -162,7 +162,7 @@ By default, watchtower is set-up to monitor the local Docker daemon (the same da
```bash ```bash
docker run -d \ docker run -d \
--name watchtower \ --name watchtower \
v2tec/watchtower --host "tcp://10.0.1.2:2375" kopfkrieg/watchtower --host "tcp://10.0.1.2:2375"
``` ```
or or
@ -171,7 +171,7 @@ or
docker run -d \ docker run -d \
--name watchtower \ --name watchtower \
-e DOCKER_HOST="tcp://10.0.1.2:2375" \ -e DOCKER_HOST="tcp://10.0.1.2:2375" \
v2tec/watchtower kopfkrieg/watchtower
``` ```
Note in both of the examples above that it is unnecessary to mount the */var/run/docker.sock* into the watchtower container. Note in both of the examples above that it is unnecessary to mount the */var/run/docker.sock* into the watchtower container.
@ -189,12 +189,12 @@ docker run -d \
--name watchtower \ --name watchtower \
-e DOCKER_HOST=$DOCKER_HOST \ -e DOCKER_HOST=$DOCKER_HOST \
-v $DOCKER_CERT_PATH:/etc/ssl/docker \ -v $DOCKER_CERT_PATH:/etc/ssl/docker \
v2tec/watchtower --tlsverify kopfkrieg/watchtower --tlsverify
``` ```
## Updating Watchtower ## Updating Watchtower
If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted */var/run/docker.sock* into the watchtower container) then it has the ability to update itself. If a new version of the *v2tec/watchtower* image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically. If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted */var/run/docker.sock* into the watchtower container) then it has the ability to update itself. If a new version of the *kopfkrieg/watchtower* image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically.
## Notifications ## Notifications
@ -233,7 +233,7 @@ docker run -d \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=fromaddress@gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=fromaddress@gmail.com \
-e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password \
v2tec/watchtower kopfkrieg/watchtower
``` ```
### Notifications through Slack webhook ### Notifications through Slack webhook
@ -253,7 +253,10 @@ docker run -d \
-e WATCHTOWER_NOTIFICATIONS=slack \ -e WATCHTOWER_NOTIFICATIONS=slack \
-e WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL="https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy" \ -e WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL="https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy" \
-e WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=watchtower-server-1 \ -e WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=watchtower-server-1 \
v2tec/watchtower -e WATCHTOWER_NOTIFICATION_SLACK_CHANNEL=#my-custom-channel \
-e WATCHTOWER_NOTIFICATION_SLACK_ICON_EMOJI=:whale: \
-e WATCHTOWER_NOTIFICATION_SLACK_ICON_URL=<icon url> \
kopfkrieg/watchtower
``` ```
### Notifications via MSTeams incoming webhook ### Notifications via MSTeams incoming webhook
@ -273,5 +276,5 @@ docker run -d \
-e WATCHTOWER_NOTIFICATIONS=msteams \ -e WATCHTOWER_NOTIFICATIONS=msteams \
-e WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL="https://outlook.office.com/webhook/xxxxxxxx@xxxxxxx/IncomingWebhook/yyyyyyyy/zzzzzzzzzz" \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL="https://outlook.office.com/webhook/xxxxxxxx@xxxxxxx/IncomingWebhook/yyyyyyyy/zzzzzzzzzz" \
-e WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true \
v2tec/watchtower kopfkrieg/watchtower
``` ```

View file

@ -2,7 +2,7 @@ version: 2
jobs: jobs:
build: build:
docker: docker:
- image: v2tec/gobuilder:0.5.0_go1.7.4-glide0.12.3-goreleaser0.59.0-docker17.05.0 - image: kopfkrieg/gobuilder:0.5.0_go1.7.4-glide0.12.3-goreleaser0.59.0-docker17.05.0
working_directory: /src working_directory: /src
steps: steps:
- checkout - checkout

View file

@ -1,4 +1,4 @@
package: github.com/v2tec/watchtower package: github.com/kopfkrieg/watchtower
import: import:
- package: github.com/sirupsen/logrus - package: github.com/sirupsen/logrus
version: ~0.11.x version: ~0.11.x

View file

@ -58,7 +58,7 @@ dockers:
goarch: amd64 goarch: amd64
goarm: '' goarm: ''
binary: watchtower binary: watchtower
image: v2tec/watchtower image: kopfkrieg/watchtower
dockerfile: dockerfile/amd64/Dockerfile dockerfile: dockerfile/amd64/Dockerfile
tag_templates: tag_templates:
- '{{ .Version }}' - '{{ .Version }}'
@ -67,7 +67,7 @@ dockers:
goarch: arm goarch: arm
goarm: 6 goarm: 6
binary: watchtower binary: watchtower
image: v2tec/watchtower image: kopfkrieg/watchtower
dockerfile: dockerfile/armhf/Dockerfile dockerfile: dockerfile/armhf/Dockerfile
tag_templates: tag_templates:
- 'armhf-{{ .Version }}' - 'armhf-{{ .Version }}'
@ -76,7 +76,7 @@ dockers:
goarch: arm64 goarch: arm64
goarm: '' goarm: ''
binary: watchtower binary: watchtower
image: v2tec/watchtower image: kopfkrieg/watchtower
dockerfile: dockerfile/arm64v8/Dockerfile dockerfile: dockerfile/arm64v8/Dockerfile
tag_templates: tag_templates:
- 'arm64v8-{{ .Version }}' - 'arm64v8-{{ .Version }}'