Home > OS >  docker watchtower - pull access denied from private docker repository
docker watchtower - pull access denied from private docker repository

Time:02-28

I've beent trying to setup a automatic docker pulling environment.
Here's my commands.

-starting app container

$docker run -d index.docker.io/<username>/<reponame>

-starting watchtower with config.json

$docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock: -v /$HOME/.docker/config.json:/$HOME/config.json: containrrr/watchtower --run-once

-/$HOME/config.json

{
    "auths": {
        "index.docker.io/<username>/<reponame>": {
            "auth": "<token>"
        }
    }
}

-and this is a response from watchtower

Error response from daemon: pull access denied for <username>/<reponame> repository does not exist or may require 'docker login'

any suggestions?

CodePudding user response:

I had to read watchtower docs very carefully. these links might help.
https://containrrr.dev/watchtower/usage-overview/
https://containrrr.dev/watchtower/private-registries/

And answer for the question, here's how i cracked it.

  • in docker-compose or docker run command parameter,config.json, you have to explicit full repository prefix and tag(ex:index.docker.io/<username>/<repository>:<tag>, maybe tag is not mandatory.).

  • and for the config.json reference, put /<path>/config.json:/config.json: instead.

  • you'll see a format error if you put your docker auth token in config.json. use echo -n '<username:<token>' | base64 to generate the token and put it in the auth value in config.json

  • Related