In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to build a private Docker warehouse in Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build a Docker private warehouse in Linux.
1. Download registry image [root@localhost ~] # docker pull registryUsing default tag: latestlatest: Pulling from library/registry486039affc0a: Pull completeba51a3b098e6: Pull complete8bb4c43d6c8e: Pull complete6f5f453e5f2d: Pull complete42bc10b72f42: Pull completeDigest: sha256:7d081088e4bfd632a88e3f3bcd9e007ef44a796fddfe3261407a3f9f04abe1e7Status: Downloaded newer image for registry:latestdocker.io/library/registry:latest2, generate registry container, open port 5000 [root@localhost ~] # docker create-it registry / bin/bashfd51aa59dc5cea7b589d0403e562cb8f0098c3a8a7da239572dd5bfd9423ec96 [root@localhost ~] # docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESfd51aa59dc5c registry "/ entrypoint.sh / bin …" 10 seconds ago Created optimistic_saha# recommends that you directly execute the following command, because the author encounters the start container and finds that the exit status code is not 0 (solved later, you can use the / bin/sh environment) [root@localhost ~] # docker run-d-p 5000 docker run 5000-v / data/registry:/tmp/registry registryceb498d622ab743fc858a993e3870f9831e20436cb71f7225215f1f0899571f1 [root@localhost ~] # docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESceb498d622ab registry "/ entrypoint.sh / etc …" 2 seconds ago Up 2 seconds 0.0.0.05000/tcp strange_swansondocker run 5000-> explanation of the data/registry:/tmp/registry registry command:-d-daemon-v-data volume setting {/ data/registry represents an absolute path in the host system, which is automatically created when it is not available / tmp/registry represents the directory inside the container} # host directory [root@localhost ~] # ls / bin boot data dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@localhost ~] # ls / data/registry# container internal directory [root@localhost ~] # docker exec-it ceb498d622ab / bin/sh/ # ls / bin etc media root srv usrdev home mnt run sys varentrypoint.sh lib proc sbin tmp/ # ls tmp/registry3, Client settings daemon.json file (specify private warehouse location) [root@localhost ~] # vim / etc/docker/daemon.json {"insecure-registries": ["20.0.0.149VOL5000"] # use the local server as the location of private warehouse "registry-mirrors": ["https://5m9y9qbl.mirror.aliyuncs.com"]}[root@localhost ~] # systemctl restart docker4, Create a local image label [root@localhost ~] # docker pull httpdUsing default tag: latestlatest: Pulling from library/httpd123275d6e508: Pull completee984dd982a6e: Pull complete963280e5cf81: Pull complete6faf90d050b2: Pull complete962b56984bb0: Pull completeDigest: sha256:d5dc0d279039da76a8b490d89a5c96da83a33842493d4336b42ccdfbd36d7409Status: Downloaded newer image for httpd:latestdocker.io/library/httpd:latest [root@localhost ~] # docker tag httpd:latest 20.0.0.149:5000/httpd5, Upload image [root@localhost ~] # docker push 149:5000/httpdThe push refers to repository [149:5000/httpd] An image does not exist locally with the tag: 149:5000/httpd [root@localhost ~] # docker push 20.0.0.149:5000/httpdThe push refers to repository [20.0.0.149:5000/httpd] 9dabb51b1ca2: Pushed4621e8a6d1da: Pushede728c649bc91: Pushed1a935e59aa8a: Pushedb60e5c3bcef2: Pushedlatest: digest: sha256:8f10edef61246c6c142a87304d4ffa68298662ecb619776e4e9817d06ec5f567 size: 1367 [root@localhost ~] # curl-XGET http://20.0.0 .149: 5000/v2/_catalog {"repositories": ["httpd"]} # the above result indicates that the upload is successful. 6. Download image test [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhttpd latest bdc169d27d36 Less than a second ago 166MB20.0.0.149:5000/httpd latest bdc169d27d36 Less than a second ago 166MBregistry latest 708bc6af7e5e 2 months ago 25.8MB [root@localhost ~] # docker rmi bdc169d27d36Error response from daemon: conflict: unable to delete bdc169d27d36 (must be forced)-image is referenced in multiple repositories [root@localhost ~] # docker rmi bdc169d27d36-fUntagged: 20.0.0.149:5000/httpd:latestUntagged: 20.0.0. 149:5000/httpd@sha256:8f10edef61246c6c142a87304d4ffa68298662ecb619776e4e9817d06ec5f567Untagged: httpd:latestUntagged: httpd@sha256:d5dc0d279039da76a8b490d89a5c96da83a33842493d4336b42ccdfbd36d7409Deleted: sha256:bdc169d27d36e2438ec8452c7dd7a52a05561b5de7bef8391849b0513a6f774bDeleted: sha256:6535aa332fb72ca508f550fef8ffb832d4c6bc72a48720b42659e10d47668181Deleted: sha256:c7bce1fab718a11501a672c895a729b1fdf8099d00fe152bef8c2534ee455976Deleted: sha256:75b6b2392924b062257ed97e5c2f3aa9f50a922b94c3f7c342d0aed2370e8becDeleted: sha256:267e2020b1bd0b182eb02d1a0f3e2f72efc542890ef6159ed9c3570322608de0Deleted: sha256:b60e5c3bcef2f42ec42648b3acf7baf6de1fa780ca16d9180f3b4a3f266fe7bc [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEregistry latest 708bc6af7e5e 2 months ago 25.8MB [root@localhost ~] # Test: [root@localhost ~] # docker pull 20.0.0.149:5000/httpdUsing default tag: latestlatest: Pulling from httpd123275d6e508: Pull completee984dd982a6e: Pull complete963280e5cf81: Pull complete6faf90d050b2: Pull complete962b56984bb0: Pull completeDigest: sha256 : 8f10edef61246c6c142a87304d4ffa68298662ecb619776e4e9817d06ec5f567Status: Downloaded newer image for 20.0.0.149:5000/httpd:latest20.0.0.149:5000/httpd:latest [root@localhost ~] #
Pull successfully and pull the mirror image very fast.
Finally, the specific solution to the error of the status code above is given:
At this point, I believe you have a deeper understanding of "how to build a private Docker warehouse in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.