1
0
mirror of https://github.com/containrrr/watchtower.git synced 2024-12-15 09:14:13 +02:00

Merge pull request #49 from v2tec/HousekeepingAfterRepoMove

Cleanup after repo move
This commit is contained in:
Fabrizio Steiner 2017-01-24 19:36:49 +01:00 committed by GitHub
commit bb99ea11e6
9 changed files with 20 additions and 39 deletions

View File

@ -1,6 +0,0 @@
FROM centurylink/ca-certs
MAINTAINER CenturyLink Labs <innovationslab@ctl.io>
LABEL "com.centurylinklabs.watchtower"="true"
COPY watchtower /
ENTRYPOINT ["/watchtower"]

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 Watchtowner contributors
Copyright 2015 Watchtower contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -1,9 +1,7 @@
# Watchtower
![Watchtower](http://panamax.ca.tier3.io/zodiac/logo-watchtower_thumb.png)
[![Circle CI](https://circleci.com/gh/CenturyLinkLabs/watchtower.svg?style=svg)](https://circleci.com/gh/CenturyLinkLabs/watchtower)&nbsp;
[![GoDoc](https://godoc.org/github.com/CenturyLinkLabs/watchtower?status.svg)](https://godoc.org/github.com/CenturyLinkLabs/watchtower)&nbsp;
[![](https://badge.imagelayers.io/centurylink/watchtower:latest.svg)](https://imagelayers.io/?images=centurylink/watchtower:latest 'Get your own badge on imagelayers.io')
[![Circle CI](https://circleci.com/gh/v2tec/watchtower.svg?style=svg)](https://circleci.com/gh/v2tec/watchtower)&nbsp;
[![GoDoc](https://godoc.org/github.com/v2tec/watchtower?status.svg)](https://godoc.org/github.com/v2tec/watchtower)&nbsp;
[![](https://images.microbadger.com/badges/image/v2tec/watchtower.svg)](https://microbadger.com/images/v2tec/watchtower "Get your own image badge on microbadger.com")
A process for watching your Docker containers and automatically restarting them whenever their base image is refreshed.
@ -19,14 +17,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 centurylink/watchtower Up 15 minutes watchtower
6cc4d2a9d1a5 v2tec/watchtower Up 15 minutes watchtower
```
Every few mintutes 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 `centurylink/watchtower` image.
Watchtower is itself packaged as a Docker container so installation is as simple as pulling the `v2tec/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 +34,7 @@ Run the `watchtower` container with the following command:
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
centurylink/watchtower
v2tec/watchtower
```
If pulling images from private Docker registries, supply registry authentication credentials with the environment variables `REPO_USER` and `REPO_PASS`
@ -58,7 +56,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 \
centurylink/watchtower nginx redis
v2tec/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.
@ -70,7 +68,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:
```
docker run --rm centurylink/watchtower --help
docker run --rm v2tec/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.
@ -112,7 +110,7 @@ By default, watchtower is set-up to monitor the local Docker daemon (the same da
```
docker run -d \
--name watchtower \
centurylink/watchtower --host "tcp://10.0.1.2:2375"
v2tec/watchtower --host "tcp://10.0.1.2:2375"
```
or
@ -121,7 +119,7 @@ or
docker run -d \
--name watchtower \
-e DOCKER_HOST="tcp://10.0.1.2:2375" \
centurylink/watchtower
v2tec/watchtower
```
Note in both of the examples above that it is unnecessary to mount the */var/run/docker.sock* into the watchtower container.
@ -139,9 +137,9 @@ docker run -d \
--name watchtower \
-e DOCKER_HOST=$DOCKER_HOST \
-v $DOCKER_CERT_PATH:/etc/ssl/docker \
centurylink/watchtower --tlsverify
v2tec/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 *centurylink/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 *v2tec/watchtower* image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically.

View File

@ -3,7 +3,7 @@ package actions
import (
"sort"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/v2tec/watchtower/container"
)
func watchtowerContainersFilter(c container.Container) bool { return c.IsWatchtower() }

View File

@ -4,7 +4,7 @@ import (
"math/rand"
"time"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/v2tec/watchtower/container"
log "github.com/Sirupsen/logrus"
)

View File

@ -1,8 +1,6 @@
machine:
services:
- docker
environment:
IMAGE_NAME: centurylink/watchtower
dependencies:
override:
@ -11,12 +9,3 @@ dependencies:
test:
override:
- docker run -v $(pwd):/src centurylink/golang-builder:latest --test
deployment:
hub:
branch: master
commands:
- docker run -v $(pwd):/src centurylink/golang-builder:latest
- docker build -t $IMAGE_NAME:latest .
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker push $IMAGE_NAME:latest

View File

@ -3,7 +3,7 @@ package mockclient
import (
"time"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/v2tec/watchtower/container"
"github.com/stretchr/testify/mock"
)

View File

@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/v2tec/watchtower/container"
)
func TestMockInterface(t *testing.T) {

View File

@ -1,4 +1,4 @@
package main // import "github.com/CenturyLinkLabs/watchtower"
package main // import "github.com/v2tec/watchtower"
import (
"fmt"
@ -8,10 +8,10 @@ import (
"syscall"
"time"
"github.com/CenturyLinkLabs/watchtower/actions"
"github.com/CenturyLinkLabs/watchtower/container"
log "github.com/Sirupsen/logrus"
"github.com/urfave/cli"
"github.com/v2tec/watchtower/actions"
"github.com/v2tec/watchtower/container"
)
var (