spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.66k stars 575 forks source link

Can't push to private Docker repo (ECR) from Mac #321

Closed danwelcome closed 7 years ago

danwelcome commented 7 years ago

Description

Since the release of the latest version of Docker for macOS, I can't push to my private repo in AWS ECR. It looks like the way the credentials are stored in the ~/.docker/config.json has changed.

How to reproduce

Via AWS, use the following command to get the command Docker uses to log into the private repo: aws ecr get-login This will store the authorization information in ~/.docker/config.json. Run a maven build with: mvn clean package docker:build -DpushImage

Software:

Full backtrace

Old ~/.docker/config.json

{
    "auths": {
        "private.repo.com": {
            "auth": "<big long string>"
        }
    }
}

New ~/.docker/config.json

{
    "auths": {
        "private.repo.com": {}
    },
    "credsStore": "osxkeychain"
}

Maven Plugin definition:

<plugins>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.4.13</version>
                    <configuration>
                        <useConfigFile>true</useConfigFile>
                        <imageName>private.repo.com/namespace/${project.artifactId}</imageName>
                        <baseImage>openjdk:8-jre</baseImage>
                        <entryPoint>java $ARGS -jar /usr/bin/${project.build.finalName}.jar >> /var/log/${project.artifactId}.log</entryPoint>
                        <forceTags>true</forceTags>
                        <imageTags>
                            <imageTag>${project.version}</imageTag>
                            <imageTag>latest</imageTag>
                        </imageTags>
                        <resources>
                            <resource>
                                <targetPath>/usr/bin/</targetPath>
                                <directory>${project.build.directory}</directory>
                                <include>${project.build.finalName}.jar</include>
                            </resource>
                        </resources>
                    </configuration>
                </plugin>

Error message: [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project seed-service: Exception caught: no basic auth credentials -> [Help 1]

d-grigorenko commented 7 years ago

Check out this issue https://github.com/docker/for-mac/issues/1439

ikelso commented 7 years ago

Check out this issue docker/for-mac#1439

I think this will help. I'm running into a similar issue, but with both aws and artifactory as my registries. I can't get a push to happen to either of them and get the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (build-image) on project com.company.example.app: Exception caught: unauthorized: The client does not have permission to push to the repository. -> [Help 1]

Seems like that issue has a PR request that's being reviewed right now so hopefully this'll make it in soon.

umcodemonkey commented 7 years ago

Not sure that PR is going to help; the creds are now, by default, in the osx keychain. I think spotify/docker-client#657 is going to need to be resolved before this plugin will work.

mattnworb commented 7 years ago

same issue as #328