Skip to content

Commit

Permalink
fix(trust): update docs according to docker registry behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts committed Jan 22, 2023
1 parent 0b68bc8 commit 6a6c7ae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
38 changes: 24 additions & 14 deletions docs/private-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,29 @@ password `auth` string:
```

`<REGISTRY_NAME>` needs to be replaced by the name of your private registry
(e.g., `my-private-registry.example.org`)

!!! important "Using private images on docker hub"
When using private images on docker hub, the containers beeing watched needs to use the full image name, including the repository prefix `docker.io`.
So instead of
```
docker run -d myuser/myimage
```
you would run it as
```
docker run -d docker.io/myuser/myimage
```

(e.g., `my-private-registry.example.org`).

!!! info "Using private images on Docker Hub"
To access private repositories on Docker Hub,
`<REGISTRY_NAME>` should be `https://index.docker.io/v1/`.
In this special case, the registry domain does not have to be specified
in `docker run` or `docker-compose`. Like Docker, Watchtower will use the
Docker Hub registry and its credentials when no registry domain is specified.

<sub>Watchtower will recognize credentials with `<REGISTRY_NAME>` `index.docker.io`,
but the Docker CLI will not.</sub>

!!! important "Using a private registry on a local host"
To use a private registry hosted locally, make sure to correctly specify the registry host
in both `config.json` and the `docker run` command or `docker-compose` file.
Valid hosts are `localhost[:PORT]`, `HOST:PORT`,
or any multi-part `domain.name` or IP-address with or without a port.

Examples:
* `localhost` -> `localhost/myimage`
* `127.0.0.1` -> `127.0.0.1/myimage:mytag`
* `host.domain` -> `host.domain/myorganization/myimage`
* `other-lan-host:80` -> `other-lan-host:80/imagename:latest`

The required `auth` string can be generated as follows:

Expand Down Expand Up @@ -75,7 +85,7 @@ When creating the watchtower container via docker-compose, use the following lin
version: "3.4"
services:
watchtower:
image: index.docker.io/containrrr/watchtower:latest
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- <PATH_TO_HOME_DIR>/.docker/config.json:/config.json
Expand Down
6 changes: 3 additions & 3 deletions docs/usage-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ docker run -d \

If you mount the config file as described above, 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 Docker Hub and monitors it with watchtower. Note the command argument changing the interval to
30s rather than the default 24 hours.
from a private repo on the GitHub Registry and monitors it with watchtower. Note the command argument changing the interval
to 30s rather than the default 24 hours.

```yaml
version: "3"
services:
cavo:
image: docker.io/<org>/<image>:<tag>
image: ghcr.io/<org>/<image>:<tag>
ports:
- "443:3443"
- "80:3080"
Expand Down

0 comments on commit 6a6c7ae

Please sign in to comment.