gpt4 book ai didi

java - 将Docker镜像推送到docker.io

转载 作者:行者123 更新时间:2023-12-02 20:17:54 26 4
gpt4 key购买 nike

我可以准备镜像,但无法将其推送到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>

最佳答案

我发现了问题,存储库名称是我的新镜像名称,因此我必须用完整的存储库名称标记本地镜像

$ docker标签local-image:tagname reponame:tagname
$ docker push reponame:标签名

对于我的示例,我已经更改了以下内容

 <docker.image.prefix>ahmetkarakaya/repo1</docker.image.prefix>

<imageName>${docker.image.prefix}</imageName>

关于java - 将Docker镜像推送到docker.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41075701/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com