update docs with new image ref parsing behavior

This commit is contained in:
Reinier van der Leer 2023-01-22 17:16:11 +01:00
parent 9606b37304
commit 905a38f24c
No known key found for this signature in database
GPG key ID: DBC4942A5C29D7FA
2 changed files with 25 additions and 15 deletions

View file

@ -23,19 +23,29 @@ password `auth` string:
``` ```
`<REGISTRY_NAME>` needs to be replaced by the name of your private registry `<REGISTRY_NAME>` needs to be replaced by the name of your private registry
(e.g., `my-private-registry.example.org`) (e.g., `my-private-registry.example.org`).
!!! important "Using private images on docker hub" !!! info "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 `index.docker.io`. To access private repositories on Docker Hub,
So instead of `<REGISTRY_NAME>` should be `https://index.docker.io/v1/`.
``` In this special case, the registry domain does not have to be specified
docker run -d myuser/myimage in `docker run` or `docker-compose`. Like Docker, Watchtower will use the
``` Docker Hub registry and its credentials when no registry domain is specified.
you would run it as
``` <sub>Watchtower will recognize credentials with `<REGISTRY_NAME>` `index.docker.io`,
docker run -d index.docker.io/myuser/myimage 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: The required `auth` string can be generated as follows:
@ -75,7 +85,7 @@ When creating the watchtower container via docker-compose, use the following lin
version: "3.4" version: "3.4"
services: services:
watchtower: watchtower:
image: index.docker.io/containrrr/watchtower:latest image: containrrr/watchtower:latest
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- <PATH_TO_HOME_DIR>/.docker/config.json:/config.json - <PATH_TO_HOME_DIR>/.docker/config.json:/config.json

View file

@ -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 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 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 from a private repo on the GitHub Registry and monitors it with watchtower. Note the command argument changing the interval
30s rather than the default 24 hours. to 30s rather than the default 24 hours.
```yaml ```yaml
version: "3" version: "3"
services: services:
cavo: cavo:
image: index.docker.io/<org>/<image>:<tag> image: ghcr.io/<org>/<image>:<tag>
ports: ports:
- "443:3443" - "443:3443"
- "80:3080" - "80:3080"