Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does docker push images to its own docker hub?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how docker pushes images to its own docker hub". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how docker pushes images to your docker hub".

1. First go to docker hub to set up your own account, and then install docker

two。 Build a warehouse on top of docker hub, such as Respositories

Name it casually, such as my springcloud

Then use the Docker hub account to verify the local login

Docker login

3. Docker images first take a look at the local image.

Here is a mirror hello-world, its mirror ID: fce289e99eb9

Then you can change it to your own image, docker tag image ID user name / image source name (repository name): new tag signature (tag)

Docker tag fce289e99eb9 oumin12345/springcloud:latest

4, push, go up.

Docker push oumin12345/springcloud:latest

Then you can see that docker hub has its own submission record.

5. Then you can pull the image by pull.

Docker pull oumin12345/springcloud

6. Execution

Docker run oumin12345/springcloud

I saw hello docker.

Build a spring boot project into a mirror

If you need to put the build project in the image, and then run the image, you can run the project.

So how do you do it?

Note that oumin12345 is the user name of my docker hub

Under the project directory, such as my project eureka

Create a new docker build file: the name is Dockerfile

If you want the project to work, you must need a java environment, the contents of the file:

FROM docker.io/library/java:8MAINTAINER XXX XXX@imooc.comADD target/*.jar app.jarEXPOSE 8761ENTRYPOINT ["java", "- jar", "/ app.jar"]

Enter the directory of the current project

Package the project into a jar package, mvn clean package-Dmaven.test.skip=true-U, and then build the image: docker build-t {hub user name} / {custom image name} .docker build-t oumin12345/eureka. After the construction is successful, you can see the image of the project through images images, and then submit it to docker hub. Docker push oumin12345/eureka can see that there is no docker hub address by default. If it is a Chinese image address, such as 360, refer to the following: mvn clean package-Dmaven.test.skip=true-Udocker build-t hub.c.163.com/springcloud/eureka .docker push hub.c.163.com/springcloud/eureka. Thank you for your reading. The above is the content of "how docker pushes images to its own docker hub". After the study of this article, I believe you have a deeper understanding of how docker pushes images to your docker hub, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report