plexsystems / sinker

A tool to sync images from one container registry to another
MIT License
609 stars 53 forks source link

Issues with pushing to docker hub #10

Closed torrespro closed 4 years ago

torrespro commented 4 years ago

Hi there, first of all, great tool!

I'm trying in my local, basic use case, read from a company repo and push to docker.io but I'm getting:

Error: push: pushing image to target: pushing image after tag: denied: requested access to the resource is denied

This is the dummy example:

target:
  registry: docker.io
  repository: torrespro
images:
- repository: authentication-dev
  version: IPS-1.12.0-no-production
  source: company/docker-releases

I can both push and pull from the terminal using plain docker commands, I understood if I can push and pull the client could do it also, or do I need to set up credentials to push to docker.io? if so, how?

Thanks in advance

jpreese commented 4 years ago

I believe I see the problem. Just for a quick sanity check, can you verify the URL that docker.io is stored in for your machine?

This is typically under ~/.docker/config.json

My understanding is that you should see https://index.docker.io/v1/

torrespro commented 4 years ago
{
        "auths": {
                "harbor.backbase.eu": {},
                "https://index.docker.io/v1/": {},
                "registry.heroku.com": {},
                "repo.backbase.com": {}
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/19.03.8 (darwin)"
        },
        "credsStore": "osxkeychain",
        "credHelpers": {
                "asia.gcr.io": "gcr",
                "eu.gcr.io": "gcr",
                "gcr.io": "gcr",
                "marketplace.gcr.io": "gcr",
                "us.gcr.io": "gcr"
        },
        "experimental": "disabled",
        "stackOrchestrator": "swarm"
}

I've changed credsStore from desktop to osxkeychain but still nothing.

If I do a docker push in another terminal I see something happening: `: ~/Development/sinker main ✗ [eba0d5b] 16:17

go run main.go push 2020/07/06 16:17:44 Finding images that do not exist at target registry ... 2020/07/06 16:17:46 Image company/docker-releases/authentication-dev:IPS-1.12.0-no-production needs to be synced 2020/07/06 16:17:46 Image company/docker-releases/authentication-dev:IPS-1.12.0-no-production exists locally. Skipping ... 2020/07/06 16:17:49 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ... 2020/07/06 16:17:56 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...`

torrespro commented 4 years ago

Is this line correct?

    if registry == "" {
        registry = "https://index.docker.io/v2/"
    }
jpreese commented 4 years ago

@torrespro this should be fixed in v0.7.1 which has been tagged/released. Can you use that version and try your push again? Thanks!

torrespro commented 4 years ago

worked

> go run main.go push
2020/07/06 16:30:30 Finding images that do not exist at target registry ...
2020/07/06 16:30:31 Image company/docker-releases/authentication-dev:IPS-1.12.0-no-production needs to be synced
2020/07/06 16:30:31 Image company/docker-releases/authentication-dev:IPS-1.12.0-no-production exists locally. Skipping ...
2020/07/06 16:30:35 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:30:41 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:30:46 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:30:51 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:30:56 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:02 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:06 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:12 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:16 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:21 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:26 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:31 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:36 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:42 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:46 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:51 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:31:56 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:01 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:06 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:11 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:16 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:21 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:26 Pushing docker.io/torrespro/authentication-dev:IPS-1.12.0-no-production ...
2020/07/06 16:32:26 All images have been pushed.
jpreese commented 4 years ago

Awesome! Glad that worked for you. 🎉

Thanks again for raising this issue.