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

Docker private warehouse building (harbor)

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

Share

Shulou(Shulou.com)06/02 Report--

Environmental preparation

Environment: two centos7 virtual machines

Virtual machine 1: 192.168.249.132 used as a private warehouse

Virtual machine 2: 192.168.249.133 user development machine

First, install Docker (virtual machine one, two)

Both hosts need to be installed. Refer to the docker installation steps.

Https://blog.51cto.com/14129044/2425605

2. Install docker-compose (virtual machine 1)

Curl-L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname-s)-$(uname-m)"-o / usr/local/bin/docker-compose

Chmod + x / usr/local/bin/docker-compose

Ln-s / usr/local/bin/docker-compose / usr/bin/docker-compose

Docker-compose-version

3. Install harbor (virtual machine 1)

1. Obtain the harbor installation package

Wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-online-installer-v1.8.1.tgz

Tar xvf harbor-online-installer-v1.8.1.tgz

2. Configure harbor.yml under the harbor directory

Vim harbor.yml

Change hostname to native IP, and other parameters can keep their default values. Port is the port number of harbor, and harbor_admin_password is the login password of admin users.

3. Start harbor

. / install.sh

4. Enter 192.168.249.132 in the browser to pop up the following interface and log in using your admin account.

5. New project (warehouse)

Create a new private warehouse named abc, which is not open to the public

Note: when the project is made public, anyone has read access to the image under this project. Command line users do not need "docker login" to pull the image under this item.

4. Use the image warehouse (virtual machine 2)

1. Log in to the private warehouse on the user's computer

Docker login 192.168.249.132

If it prompts "Error response from daemon: Get https://192.168.249.132/v2/: dial tcp 192.168.249.132": connect: connection refused "

In the docker1.3.2 version, the default docker registry is https. We set the default http mode of Harbor, so there will be an error when you use docker login, pull, push and other commands to operate non-https docker regsitry.

To solve the problem, add the following parameters to the file (create if not) / etc/docker/daemon.json on the client host that initiated the login:

{

"insecure-registries": ["192.168.249.132"]

}

Restart docker:systemctl restart docker.service

Log in again and show success

2. Upload the image to the repository

Check that the nginx:latest image currently exists on this machine

Hit tag first, and then upload it with push.

Docker tag nginx:latest 192.168.249.132/abc/nginx:v1

Docker push 192.168.249.132/abc/nginx:v1

3. Image download

Delete the 192.168.249.132/abc/nginx:v1 image just uploaded on the user's computer, and use the docke image ls command to check to make sure that the image is no longer available locally.

If you use the pull command to download from the private image warehouse, you can see that the download has been successful.

Docker pull 192.168.249.132/abc/nginx:v1

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