In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to make a mirror image in Docker, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Preface
Take the creation of CentOS images as an example to describe the process of customizing, packaging and pushing remote repositories for images. The steps are relatively simple and quick to get started.
Create steps to create a CentOS basic image
Create the build directory and Dockerfile, and edit the image-related settings in Dockerfile.
Echo "create a directory under the current user directory docker/build/centos_7.8.2003" > / dev/nullmkdir-p ~ / docker/build/centos_7.8.2003echo "create Dockerfile to ~ / docker/build/centos_7.8.2003 directory" > / dev/nullcat > ~ / docker/build/centos_7.8.2003/Dockerfile / dev/nulldocker run\-- name base-centos\-- privileged=true\-dit\ base-centos\ / usr/sbin / initecho "enter the centos container" > / dev/nulldocker exec-it base-centos / bin/bash
Customize the virtual system in the container, such as installing common tools. In fact, these can also be written in Dockerfile, defined after the RUN instruction.
Echo "vim: edit file" > / dev/nullyum install-y vimecho "lsof: easy to view port information" > / dev/nullyum install-y lsofecho "wget: file download" > / dev/nullyum install-y wgetecho "tree: view directory structure" > / dev/nullyum install-y treeecho "install python" > / dev/nullyum install-y python-develecho "C compilation environment" > / dev/nullyum install-y gcc gcc-c++yum install-y zlibyum install-y zlib- Develyum install-y tcl build-essential tk gettext creates a new image in a custom container
The command format is docker commit:, and the default latest does not write the image version number. This container can also be in a stopped state when created.
Docker commit base-centos centos:7.8.2003_v1
At this point, the image is created, and the new image can be seen in the image list.
Save and load the mirror tar package
Save the image as a tar package in the format of docker save-o:, refer to the rookie tutorial-docker save.
Docker save-o ~ / docker/build/centos_7.8.2003/centos_7.8.2003.tar centos:7.8.2003_v1
Load the tar package to generate an image.
Docker load-- input ~ / docker/build/centos_7.8.2003/centos_7.8.2003.tar
There is already a duplicate mirror execution load command is invalid.
Push the image to the remote warehouse
Docker logs in to the remote warehouse. The format is docker login-- username= or docker login-u-p.
Docker tag: after the tag.
Echo "tag image address and version number" > / dev/nulldocker tag 66b1bc81e1f2 registry.cn-shanghai.aliyuncs.com/exposure/centos:7.8.2003_v1
Docker push: push to the remote warehouse.
Echo "push to remote Warehouse" > / dev/nulldocker push registry.cn-shanghai.aliyuncs.com/exposure/centos:7.8.2003_v1 is all the contents of this article "how to make an Image in Docker". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.