0

I'm using GCP's container-optimized image to run a number of containers through docker compose. As mentioned in this article, public repositories are working fine but I can't figure out why docker login in the host machine is not reflected in the docker-compose container.

docker login -u "bohemia" -p"randompass" docker.coolregistry.com

which gives:

WARNING! Your password will be stored unencrypted in /home/bohemia/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded

I'm not using any credential helper, so mounting the path to the docker config (with the updated token) to the container running compose should work.

docker run -it --rm \
    -v "/var/run/docker.sock:/var/run/docker.sock" \
    -v "$HOME/.docker/config.json:$HOME/.docker/config.json" \
    -v "$PWD:$PWD" \
    -w="$PWD" \
    docker/compose:1.24.0 up -d

But I'm still getting the following error:

...
Pulling container (docker.coolregistry.com/this_image:latest)...
ERROR: Get https://docker.coolregistry.com/v2/this_image/manifests/latest: no basic auth credentials

What am I missing here?

3
  • How are you running the docker run command? Container OS does not maintain changes across reboots. More details are required. Commented Mar 17, 2021 at 19:57
  • @JohnHanley This code will be saved in the gcp meta servers as startup script. The idea is to start the instance and run the docker-compose.yml file to spawn containers. Let me know what details would be of help. Commented Mar 17, 2021 at 22:36
  • The startup script does not use your user's $HOME. Commented Mar 17, 2021 at 23:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.