Skip to content

Commit 9045c0a

Browse files
authoredJun 5, 2024··
docs(main): Private registry (#598)
Following #566 - Private registry, adding the relevant doc so the usage will be clear and (hopefully) reachable.
1 parent 54c88cf commit 9045c0a

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed
 

‎index.rst

+34-11
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,43 @@ When trying to launch a testcontainer from within a Docker container, e.g., in c
103103
1. The container has to provide a docker client installation. Either use an image that has docker pre-installed (e.g. the `official docker images <https://hub.docker.com/_/docker>`_) or install the client from within the `Dockerfile` specification.
104104
2. The container has to have access to the docker daemon which can be achieved by mounting `/var/run/docker.sock` or setting the `DOCKER_HOST` environment variable as part of your `docker run` command.
105105

106+
Private Docker registry
107+
-----------------------
108+
109+
Using a private docker registry requires the `DOCKER_AUTH_CONFIG` environment variable to be set. `official documentation <https://docs.docker.com/engine/reference/commandline/login/#credential-helpers>`
110+
111+
The value of this variable should be a JSON string containing the authentication information for the registry.
112+
113+
In order to generate the JSON string, you can use the following command:
114+
``echo -n '{"auths": {"<url>": {"auth": "'$(echo -n "<username>:<password>" | base64 -w 0)'"}}}'``
115+
116+
Example:
117+
``DOCKER_AUTH_CONFIG='{"auths": {"https://myregistry.com": {"auth": "dXNlcm5hbWU6cGFzc3dvcmQ="}}}'``
118+
119+
Fetching passwords from cloud providers:
120+
121+
* ``ECR_PASSWORD = $(aws ecr get-login-password --region eu-west-1)``
122+
* ``GCP_PASSWORD = $(gcloud auth print-access-token)``
123+
* ``AZURE_PASSWORD = $(az acr login --name <registry-name> --expose-token --output tsv)``
124+
125+
126+
106127
Configuration
107128
-------------
108129

109-
+-------------------------------------------+-------------------------------+------------------------------------------+
110-
| Env Variable | Example | Description |
111-
+===========================================+===============================+==========================================+
112-
| ``TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE`` | ``/var/run/docker.sock`` | Path to Docker's socket used by ryuk |
113-
+-------------------------------------------+-------------------------------+------------------------------------------+
114-
| ``TESTCONTAINERS_RYUK_PRIVILEGED`` | ``false`` | Run ryuk as a privileged container |
115-
+-------------------------------------------+-------------------------------+------------------------------------------+
116-
| ``TESTCONTAINERS_RYUK_DISABLED`` | ``false`` | Disable ryuk |
117-
+-------------------------------------------+-------------------------------+------------------------------------------+
118-
| ``RYUK_CONTAINER_IMAGE`` | ``testcontainers/ryuk:0.7.0`` | Custom image for ryuk |
119-
+-------------------------------------------+-------------------------------+------------------------------------------+
130+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
131+
| Env Variable | Example | Description |
132+
+===========================================+===================================================+==========================================+
133+
| ``TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE`` | ``/var/run/docker.sock`` | Path to Docker's socket used by ryuk |
134+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
135+
| ``TESTCONTAINERS_RYUK_PRIVILEGED`` | ``false`` | Run ryuk as a privileged container |
136+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
137+
| ``TESTCONTAINERS_RYUK_DISABLED`` | ``false`` | Disable ryuk |
138+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
139+
| ``RYUK_CONTAINER_IMAGE`` | ``testcontainers/ryuk:0.7.0`` | Custom image for ryuk |
140+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
141+
| ``DOCKER_AUTH_CONFIG`` | ``{"auths": {"<url>": {"auth": "<encoded>"}}}`` | Custom registry auth config |
142+
+-------------------------------------------+---------------------------------------------------+------------------------------------------+
120143

121144
Development and Contributing
122145
----------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.