In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Docker image and warehouse". The content of 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 to use Docker image and warehouse".
Docker Mirror
Superimposed by the file system
The first layer at the bottom is the boot file system bootfs, similar to grub
The second layer of mirroring is root file system rootfs
List Mirror
Huangyi@HP ~% sudo docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu latest cdd474520b8c 2 days ago 188 MB
Delete Mirror
Sudo docker rmi ubuntu
Relationship between image and container
One to many
Mirror image-- > program
Container-- > process
Warehouse
View other images in the ubuntu repository
HP docker # sudo docker pull ubuntuPulling repository ubuntuc6a3582257ff: Pulling image (vivid-20150528) from ubuntu, endpoint: https://registry-1.docker.io/v1/ 5ba9dab47459: Pulling image (14.04.1) from ubuntu, endpoint: https://registry-1.docker.io/v1/commit to build a new image
Create a custom container to modify
Sudo docker run-I-t ubuntu / bin/bash
Install vim in the container
Root@93a46591d393:/# sudo apt-get install vimReading package lists... Done
Submit
HP huangyi # sudo docker commit 93a46591d393 ubuntu/myvim3806f1faa5f007ccc756c96490d23c75fb8ede77775c3cd2b310617038157876
Looking at the current Repo of this machine, you can see that there is an extra ubuntu/myvim.
HP huangyi # sudo docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu/myvim latest 3806f1faa5f0 2 minutes ago 231.4 MBubuntu latest cdd474520b8c 3 days ago 188 MB
# # Building a new image based on Dockerfile
HP Docker # tree. └── static_web └── Dockerfile
Dockerfile file
# Version: 0.01FROM ubuntuMAINTAINER name "ituzhi@163.com" RUN apt-get updateRUN apt-get install-y nginxRUN echo'Hi, I am in your container'\ > / usr/share/nginx/html/index.htmlEXPOSE 80
Build an image
Sudo docker build-t = "name/static_web".
Looking at Repo, you can see that there is an extra name/static_web.
Huangyi@HP ~ $sudo docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEname/static_web latest 1f8ee6fd2bd6 5 minutes ago 227.7 MBubuntu/myvim latest 3806f1faa5f0 29 minutes ago 231.4 MBubuntu latest cdd474520b8c 3 days ago 188 MB
Each of the above RUN statements generates a new mirror, updates the mirror ID, and deletes the old mirror.
View the final image
Huangyi@HP ~ $sudo docker run-t-I 1f8ee6fd2bd6 / bin/bashroot@778aa645f23f:/# cat / usr/share/nginx/html/index.htmlHi, I am in your containe
It can be seen that the image was built successfully.
You can also start Nginx in the container.
Sudo docker run-I-t-p 80 titus/static_webnginx-g "daemon off"
The-p option binds port 49153 of the host to port 80 of the container, in the host
HP static_web # curl 192.168.1.154:49153Hi, I am in your container
# # push image to Docker Hub and log in to Docker Hub
Sudo docker login
Push
Docker push name/web
It is important to note that the username at build time must be the user name in Docker Hub
Sudo docker build-t = "name/static_web".
# # reference
Http://stackoverflow.com/questions/25388684/pushing-docker-image-to-dockerhub
Thank you for your reading. the above is the content of "how to use Docker images and repositories". After the study of this article, I believe you have a deeper understanding of how to use Docker images and warehouses, and the specific usage 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.