I have a plugin to create a image, once created it need to be pushed to amazon ECR Please look into my plugin in the below`
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.24.0</version>
<configuration>
<dockerHost>https://accountID.dkr.ecr.us-east-1.amazonaws.com</dockerHost>
<authConfig>
<authToken>authorization Token</authToken>
<username>Access Key ID</username>
<password>Secret Key Id</password>
</authConfig>
<images>
<image>
<alias>service</alias>
<name>${project.artifactId}</name>
<build>
<from>openjdk:8-jdk-alpine</from>
<entryPoint>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>maven/app.jar</arg>
</exec>
</entryPoint>
<assembly>
<descriptorRef>artifact-with-dependencies</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>docker-build</id>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
`
I have tried with above plugin with authorization token as authtoken . when i am running maven build getting not authorized .
Help will be appreciated
Thanks, Damodar
You can use the AWS ECR credential helper
Please read the documentation for further details, but here are the major steps to get it working:
{
"credHelpers": {
"accountID.dkr.ecr.us-east-1.amazonaws.com": "ecr-login"
},
... (already existing stuff in my setup)
}
AWS_SDK_LOAD_CONFIG=true
AWS_PROFILE=your_aws_profile
Maybe you will need to define AWS_REGION as environment variable as well.
Now when running the maven build, the ECR credential helper should take care of the authentication process, so the "authConfig"-part of the config in the question can be removed.