我可以准备一张图片,但无法将其推入docker.io帐户, https://hub.docker.com/r/ahmetkarakaya/repo1/
mvn package docker:build -DpushImage
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ gs-spring-boot-docker ---
[INFO] Building jar: C:\Users\ttahkarakaya.TCLL\Desktop\gs-spring-boot-docker\complete\target\gs-spring-boot-docker-0.1.0.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.4.2.RELEASE:repackage (default) @ gs-spring-boot-docker ---
[INFO]
[INFO] --- docker-maven-plugin:0.4.11:build (default-cli) @ gs-spring-boot-docker ---
[INFO] Copying C:\Users\ttahkarakaya.TCLL\Desktop\gs-spring-boot-docker\complete\target\gs-spring-boot-docker-0.1.0.jar -> C:\Users\ttahkarakaya.TCLL\D
-docker\complete\target\docker\gs-spring-boot-docker-0.1.0.jar
[INFO] Copying src\main\docker\Dockerfile -> C:\Users\ttahkarakaya.TCLL\Desktop\gs-spring-boot-docker\complete\target\docker\Dockerfile
[INFO] Building image docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker
Step 1 : FROM frolvlad/alpine-oraclejdk8:slim
---> f8103909759b
Step 2 : VOLUME /tmp
---> Using cache
---> 36841e0d87cf
Step 3 : ADD gs-spring-boot-docker-0.1.0.jar app.jar
---> 6ef1582aca5e
Removing intermediate container 0bfc9fcc8f60
Step 4 : RUN sh -c 'touch /app.jar'
---> Running in 0793aea1556d
---> c4b8911cf071
Removing intermediate container 0793aea1556d
Step 5 : ENV JAVA_OPTS ""
---> Running in 1f0c5db71b84
---> f7d64cfaa34d
Removing intermediate container 1f0c5db71b84
Step 6 : ENTRYPOINT sh -c java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
---> Running in dd555e3e3b89
---> b71f4b224bbd
Removing intermediate container dd555e3e3b89
Successfully built b71f4b224bbd
[INFO] Built docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker
[INFO] Tagging docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker with 0.1.0
[INFO] Tagging docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker with latest
[INFO] Pushing docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker
The push refers to a repository [docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker]
db4ee565a05f: Preparing
1d63660fa197: Preparing
a27c88827076: Preparing
58f7b9930e4f: Preparing
9007f5987db3: Preparing
[WARNING] Failed to push docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker, retrying in 10 seconds (1/5).
[INFO] Pushing docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker
The push refers to a repository [docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker]
db4ee565a05f: Preparing
1d63660fa197: Preparing
a27c88827076: Preparing
58f7b9930e4f: Preparing
9007f5987db3: Preparing
[WARNING] Failed to push docker.io/ahmetkarakaya/repo1/gs-spring-boot-docker, retrying in 10 seconds (2/5).
Terminate batch job (Y/N)? y
C:\Users\ttahkarakaya.TCLL\Desktop\gs-spring-boot-docker\complete>
的pom.xml
<properties>
<docker.image.prefix>docker.io/ahmetkarakaya/repo1</docker.image.prefix>
<java.version>1.8</java.version>
</properties>
docker.io/ahmetkarakaya/repo1 1.8
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::plugin[] -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<serverId>docker-hub</serverId>
<registryUrl>https://index.docker.io/v1/</registryUrl>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
</configuration>
</plugin>
<!-- end::plugin[] -->
</plugins>
</build>
答案 0 :(得分:0)
我发现了问题,存储库名称是我的新图像名称,因此我必须使用完整的重新命名标记本地图像
$ docker tag local-image:tagname reponame:tagname $ docker push reponame:tagname
对于我的例子我改变了以下内容,因为它是
<docker.image.prefix>ahmetkarakaya/repo1</docker.image.prefix>
<imageName>${docker.image.prefix}</imageName>