Mvn clean package docker:build docker:push is failing

Hi, I am running docker inside of Ubuntu 16.04 (which is running inside Oracle virtual box). When I run mvn clean package docker:build docker:push, I got below error. I am using fabric8 plugin to push to docker repository. I have entered my credentials in maven settings.xml as well. Appreciate for your help

<server>
		<username>sample</username>
		<password>sample</password>
		<id>docker.io</id>
		<configuration>
			<email>saample@gmail.com</email>
		</configuration>
	</server>

[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot-docker 0.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-clean-plugin:2.6.1:clean (default-clean) @ spring-boot-docker —
[INFO] Deleting /home/satya/Desktop/advJava/docker/spring-boot-docker/target
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-docker —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 38 resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot-docker —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /home/satya/Desktop/advJava/docker/spring-boot-docker/target/classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-docker —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/satya/Desktop/advJava/docker/spring-boot-docker/src/test/resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot-docker —
[INFO] No sources to compile
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ spring-boot-docker —
[INFO] No tests to run.
[INFO]
[INFO] — gmavenplus-plugin:1.5:execute (default) @ spring-boot-docker —
[INFO] Using Groovy 2.4.8 to perform execute.
[INFO] Fetching Groovy script from file:////home/satya/Desktop/advJava/docker/spring-boot-docker/src/main/scripts/BuildDockerfile.groovy.
writing dir /home/satya/Desktop/advJava/docker/spring-boot-docker/target/dockerfile
writing file
[INFO]
[INFO] — maven-jar-plugin:2.6:jar (default-jar) @ spring-boot-docker —
[INFO] Building jar: /home/satya/Desktop/advJava/docker/spring-boot-docker/target/spring-boot-docker-0.0.3-SNAPSHOT.jar
[INFO]
[INFO] — spring-boot-maven-plugin:1.5.1.RELEASE:repackage (default) @ spring-boot-docker —
[INFO]
[INFO] — docker-maven-plugin:0.20.0:build (default-cli) @ spring-boot-docker —
[INFO] Copying files to /home/satya/Desktop/advJava/docker/spring-boot-docker/target/docker/springframeworkguru/springbootdocker/build/maven
[INFO] Building tar: /home/satya/Desktop/advJava/docker/spring-boot-docker/target/docker/springframeworkguru/springbootdocker/tmp/docker-build.tar
[INFO] DOCKER> docker-build.tar: Created [springframeworkguru/springbootdocker] in 5 seconds
[INFO] DOCKER> Step 1/5 : FROM openjdk
[INFO] DOCKER>
[INFO] DOCKER> —> b697a97ee8e1
[INFO] DOCKER> Step 2/5 : VOLUME /tmp
[INFO] DOCKER>
[INFO] DOCKER> —> Using cache
[INFO] DOCKER> —> 379c29d85e17
[INFO] DOCKER> Step 3/5 : ADD maven/spring-boot-docker-0.0.3-SNAPSHOT.jar spring-boot-docker-0.0.3-SNAPSHOT.jar
[INFO] DOCKER>
[INFO] DOCKER> —> a679582dc7d9
[INFO] DOCKER> Step 4/5 : RUN sh -c ‘touch /spring-boot-docker-0.0.3-SNAPSHOT.jar’
[INFO] DOCKER>
[INFO] DOCKER> —> Running in 05d6c4f279a9
[INFO] DOCKER> Removing intermediate container 05d6c4f279a9
[INFO] DOCKER> —> 479d191af1a2
[INFO] DOCKER> Step 5/5 : ENTRYPOINT [“java”,"-Djava.security.egd=file:/dev/./urandom","-jar","/spring-boot-docker-0.0.3-SNAPSHOT.jar"]
[INFO] DOCKER>
[INFO] DOCKER> —> Running in bfc43bf31dd3
[INFO] DOCKER> Removing intermediate container bfc43bf31dd3
[INFO] DOCKER> —> 217e3111d27f
[INFO] DOCKER> Successfully built 217e3111d27f
[INFO] DOCKER> Successfully tagged springframeworkguru/springbootdocker:latest
[INFO] DOCKER> [springframeworkguru/springbootdocker]: Built image sha256:217e3
[INFO] DOCKER> [springframeworkguru/springbootdocker]: Removed old image sha256:cac67
[INFO] DOCKER> [springframeworkguru/springbootdocker]: Tag with latest,0.0.3-SNAPSHOT
[INFO]
[INFO] — docker-maven-plugin:0.20.0:push (default-cli) @ spring-boot-docker —

[INFO] DOCKER> The push refers to repository [docker.io/springframeworkguru/springbootdocker]

[ERROR] DOCKER> Unable to push ‘springframeworkguru/springbootdocker’
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.639 s
[INFO] Finished at: 2019-04-16T17:59:19-04:00
[INFO] Final Memory: 44M/547M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.20.0:push (default-cli) on project spring-boot-docker: Unable to push ‘springframeworkguru/springbootdocker’: denied: requested access to the resource is denied -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How do you add settings.xml to the build? The recommended way to do it now is to add it to the ref directory.

COPY settings.xml /usr/share/maven/ref/

I have noticed that it works better when I use the organisation name in the auth-settings and not only the docker.io as identifyer, like this:

<servers>
  <server>
    <id>docker.io/limestream</id>
    <username>lime</username>
    <password>s!cr!t</password>
  </server>
  ....
</servers>

. I tried ur suggestion @ovelindstrom , unfortunately it didn’t work. It still shows the same error.

Hi @satykrishna ,
I hope you were able to resolve this issue.

The logs say:

that means you are pushing your image: springbootdocker to account springframeworkguru, which is not your account name. You need to put your own account user name in pom in <name></name> tag of <image></image> tag.