From 9045c0aea6029283490c89aea985e625dcdfc7b9 Mon Sep 17 00:00:00 2001 From: Roy Moore Date: Thu, 6 Jun 2024 00:18:21 +0300 Subject: [PATCH] docs(main): Private registry (#598) Following #566 - Private registry, adding the relevant doc so the usage will be clear and (hopefully) reachable. --- index.rst | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/index.rst b/index.rst index 3c7fcc14..a9dca6df 100644 --- a/index.rst +++ b/index.rst @@ -103,20 +103,43 @@ When trying to launch a testcontainer from within a Docker container, e.g., in c 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 `_) or install the client from within the `Dockerfile` specification. 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. +Private Docker registry +----------------------- + +Using a private docker registry requires the `DOCKER_AUTH_CONFIG` environment variable to be set. `official documentation ` + +The value of this variable should be a JSON string containing the authentication information for the registry. + +In order to generate the JSON string, you can use the following command: +``echo -n '{"auths": {"": {"auth": "'$(echo -n ":" | base64 -w 0)'"}}}'`` + +Example: +``DOCKER_AUTH_CONFIG='{"auths": {"https://myregistry.com": {"auth": "dXNlcm5hbWU6cGFzc3dvcmQ="}}}'`` + +Fetching passwords from cloud providers: + +* ``ECR_PASSWORD = $(aws ecr get-login-password --region eu-west-1)`` +* ``GCP_PASSWORD = $(gcloud auth print-access-token)`` +* ``AZURE_PASSWORD = $(az acr login --name --expose-token --output tsv)`` + + + Configuration ------------- -+-------------------------------------------+-------------------------------+------------------------------------------+ -| Env Variable | Example | Description | -+===========================================+===============================+==========================================+ -| ``TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE`` | ``/var/run/docker.sock`` | Path to Docker's socket used by ryuk | -+-------------------------------------------+-------------------------------+------------------------------------------+ -| ``TESTCONTAINERS_RYUK_PRIVILEGED`` | ``false`` | Run ryuk as a privileged container | -+-------------------------------------------+-------------------------------+------------------------------------------+ -| ``TESTCONTAINERS_RYUK_DISABLED`` | ``false`` | Disable ryuk | -+-------------------------------------------+-------------------------------+------------------------------------------+ -| ``RYUK_CONTAINER_IMAGE`` | ``testcontainers/ryuk:0.7.0`` | Custom image for ryuk | -+-------------------------------------------+-------------------------------+------------------------------------------+ ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ +| Env Variable | Example | Description | ++===========================================+===================================================+==========================================+ +| ``TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE`` | ``/var/run/docker.sock`` | Path to Docker's socket used by ryuk | ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ +| ``TESTCONTAINERS_RYUK_PRIVILEGED`` | ``false`` | Run ryuk as a privileged container | ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ +| ``TESTCONTAINERS_RYUK_DISABLED`` | ``false`` | Disable ryuk | ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ +| ``RYUK_CONTAINER_IMAGE`` | ``testcontainers/ryuk:0.7.0`` | Custom image for ryuk | ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ +| ``DOCKER_AUTH_CONFIG`` | ``{"auths": {"": {"auth": ""}}}`` | Custom registry auth config | ++-------------------------------------------+---------------------------------------------------+------------------------------------------+ Development and Contributing ----------------------------