diff --git a/Dockerfile b/Dockerfile index 6b9555a..530b763 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,7 @@ ## -## Alpine image to get some needed data +# Build ## -#FROM alpine:latest as alpine -#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 +FROM golang:alpine as build-env 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 go build -o watchtower . -# final stage +## +# Watchtower +## FROM alpine LABEL "com.centurylinklabs.watchtower"="true" diff --git a/README.md b/README.md index 5bc2100..f757d47 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Watchtower -[![Circle CI](https://circleci.com/gh/v2tec/watchtower.svg?style=shield)](https://circleci.com/gh/v2tec/watchtower) -[![GoDoc](https://godoc.org/github.com/v2tec/watchtower?status.svg)](https://godoc.org/github.com/v2tec/watchtower) -[![](https://images.microbadger.com/badges/image/v2tec/watchtower.svg)](https://microbadger.com/images/v2tec/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) +[![Circle CI](https://circleci.com/gh/kopfkrieg/watchtower.svg?style=shield)](https://circleci.com/gh/kopfkrieg/watchtower) +[![GoDoc](https://godoc.org/github.com/kopfkrieg/watchtower?status.svg)](https://godoc.org/github.com/kopfkrieg/watchtower) +[![](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/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. @@ -19,14 +19,14 @@ For example, let's say you were running watchtower along with an instance of *ce $ docker ps CONTAINER ID IMAGE STATUS PORTS NAMES 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). ## 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. @@ -36,7 +36,7 @@ Run the `watchtower` container with the following command: docker run -d \ --name watchtower \ -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` @@ -47,7 +47,7 @@ docker run -d \ --name watchtower \ -v /home//.docker/config.json:/config.json \ -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. @@ -61,7 +61,7 @@ services: - "443:3443" - "80:3080" watchtower: - image: v2tec/watchtower + image: kopfkrieg/watchtower volumes: - /var/run/docker.sock:/var/run/docker.sock - /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 \ --name watchtower \ -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. @@ -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: ```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. @@ -162,7 +162,7 @@ By default, watchtower is set-up to monitor the local Docker daemon (the same da ```bash docker run -d \ --name watchtower \ - v2tec/watchtower --host "tcp://10.0.1.2:2375" + kopfkrieg/watchtower --host "tcp://10.0.1.2:2375" ``` or @@ -171,7 +171,7 @@ or docker run -d \ --name watchtower \ -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. @@ -189,12 +189,12 @@ docker run -d \ --name watchtower \ -e DOCKER_HOST=$DOCKER_HOST \ -v $DOCKER_CERT_PATH:/etc/ssl/docker \ - v2tec/watchtower --tlsverify + kopfkrieg/watchtower --tlsverify ``` ## 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 @@ -233,7 +233,7 @@ docker run -d \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=fromaddress@gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password \ - v2tec/watchtower + kopfkrieg/watchtower ``` ### Notifications through Slack webhook @@ -253,7 +253,10 @@ docker run -d \ -e WATCHTOWER_NOTIFICATIONS=slack \ -e WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL="https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy" \ -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= \ + kopfkrieg/watchtower ``` ### Notifications via MSTeams incoming webhook @@ -273,5 +276,5 @@ docker run -d \ -e WATCHTOWER_NOTIFICATIONS=msteams \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL="https://outlook.office.com/webhook/xxxxxxxx@xxxxxxx/IncomingWebhook/yyyyyyyy/zzzzzzzzzz" \ -e WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true \ - v2tec/watchtower + kopfkrieg/watchtower ``` diff --git a/circle.yml b/circle.yml index 613fd74..28e14d6 100644 --- a/circle.yml +++ b/circle.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: 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 steps: - checkout diff --git a/glide.yaml b/glide.yaml index 20ef77d..7f1ad3a 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,4 +1,4 @@ -package: github.com/v2tec/watchtower +package: github.com/kopfkrieg/watchtower import: - package: github.com/sirupsen/logrus version: ~0.11.x diff --git a/goreleaser.yml b/goreleaser.yml index fed2baa..8ab2001 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -58,7 +58,7 @@ dockers: goarch: amd64 goarm: '' binary: watchtower - image: v2tec/watchtower + image: kopfkrieg/watchtower dockerfile: dockerfile/amd64/Dockerfile tag_templates: - '{{ .Version }}' @@ -67,7 +67,7 @@ dockers: goarch: arm goarm: 6 binary: watchtower - image: v2tec/watchtower + image: kopfkrieg/watchtower dockerfile: dockerfile/armhf/Dockerfile tag_templates: - 'armhf-{{ .Version }}' @@ -76,7 +76,7 @@ dockers: goarch: arm64 goarm: '' binary: watchtower - image: v2tec/watchtower + image: kopfkrieg/watchtower dockerfile: dockerfile/arm64v8/Dockerfile tag_templates: - 'arm64v8-{{ .Version }}'