From 90ef4022f7c25386c53ce7e687aeb19411669039 Mon Sep 17 00:00:00 2001 From: Simon Aronsson Date: Sat, 28 Mar 2020 20:05:59 +0100 Subject: [PATCH] add additional note on gcloud credentials --- docs/private-registries.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/private-registries.md b/docs/private-registries.md index 13e7618..3606c2a 100644 --- a/docs/private-registries.md +++ b/docs/private-registries.md @@ -1,12 +1,17 @@ -Watchtower supports private Docker image registries. In many cases, accessing a private registry requires a valid username and password (i.e., _credentials_). In order to operate in such an environment, watchtower needs to know the credentials to access the registry. +Watchtower supports private Docker image registries. In many cases, accessing a private registry +requires a valid username and password (i.e., _credentials_). In order to operate in such an +environment, watchtower needs to know the credentials to access the registry. -The credentials can be provided to watchtower in a configuration file called `config.json`. There are two ways to generate this configuration file: +The credentials can be provided to watchtower in a configuration file called `config.json`. +There are two ways to generate this configuration file: * The configuration file can be created manually. * Call `docker login ` and share the resulting configuration file. ### Create the configuration file manually -Create a new configuration file with the following syntax and a base64 encoded username and password `auth` string: +Create a new configuration file with the following syntax and a base64 encoded username and +password `auth` string: + ```json { "auths": { @@ -17,27 +22,40 @@ Create a new configuration file with the following syntax and a base64 encoded u } ``` -`` needs to be replaced by the name of your private registry (e.g., `my-private-registry.example.org`) +`` needs to be replaced by the name of your private registry +(e.g., `my-private-registry.example.org`) The required `auth` string can be generated as follows: ```bash echo -n 'username:password' | base64 ``` -When the watchtower Docker container is started, the created configuration file (`/config.json` in this example) needs to be passed to the container: +> ### ℹ️ Username and Password for GCloud +> +> For gcloud, we'll use `__json_key` as our username and the content +> of `gcloudauth.json` as the password. + +When the watchtower Docker container is started, the created configuration file +(`/config.json` in this example) needs to be passed to the container: + ```bash docker run [...] -v /config.json:/config.json containrrr/watchtower ``` ### Share the Docker configuration file -To pull an image from a private registry, `docker login` needs to be called first, to get access to the registry. The provided credentials are stored in a configuration file called `/.docker/config.json`. This configuration file can be directly used by watchtower. In this case, the creation of an additional configuration file is not necessary. +To pull an image from a private registry, `docker login` needs to be called first, to get access +to the registry. The provided credentials are stored in a configuration file called `/.docker/config.json`. +This configuration file can be directly used by watchtower. In this case, the creation of an +additional configuration file is not necessary. When the Docker container is started, pass the configuration file to watchtower: + ```bash docker run [...] -v /.docker/config.json:/config.json containrrr/watchtower ``` When creating the watchtower container via docker-compose, use the following lines: + ```yaml version: "3" [...]