`
sillycat
  • 浏览: 2535970 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Private Docker Registry Harbor(1)Installation and Configuration

 
阅读更多
Private Docker Registry Harbor(1)Installation and Configuration

Docker register 2
https://docs.docker.com/registry/deploying/
https://hub.docker.com/r/konradkleine/docker-registry-frontend/
https://docs.docker.com/registry/
Harbor is using registry v2 under line.
http://www.ywnds.com/?p=7958
Installation
http://blog.51cto.com/slitobo/2323332
Check version on my Ubuntu
> docker --version
Docker version 18.06.1-ce, build e68fc7a
Make Sure docker-compose is there
> sudo apt install docker-compose
> docker-compose version
docker-compose version 1.17.1, build unknown
docker-py version: 2.5.1
CPython version: 2.7.15rc1
OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017
Find the offline release version from here https://github.com/goharbor/harbor/releases
> wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.1.tgz
Unzip the file
> tar -xf harbor-offline-installer-v1.7.1.tgz
Move to work directory
> mv harbor ~/tool/harbor-1.7.1
> sudo ln -s /home/ubuntu/tool/harbor-1.7.1 /opt/harbor-1.7.1
> sudo ln -s /opt/harbor-1.7.1 /opt/harbor
Changed some configurations in harbor.cfg
hostname = 52.13.38.xxx
ui_url_protocol = http
harbor_admin_password = xxxxxxxx
Load the Configuration
>  sudo ./prepare
Install
>  sudo ./install.sh
After that it says successfully installed, and we can visit
http://ubuntu-master
If you do docker ps, you can see a lot of docker applications running
51d4052c3aee        goharbor/harbor-jobservice:v1.7.1        "/harbor/start.sh"       57 seconds ago       Up 56 seconds                                                                                         harbor-jobservice
dc549f7ab2a4        goharbor/nginx-photon:v1.7.1             "nginx -g 'daemon of…"   57 seconds ago       Up 56 seconds (healthy)            0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp   nginx
6cc8885741ab        goharbor/harbor-portal:v1.7.1            "nginx -g 'daemon of…"   57 seconds ago       Up 57 seconds (healthy)            80/tcp                                                             harbor-portal
64201aa99eb9        goharbor/harbor-core:v1.7.1              "/harbor/start.sh"       58 seconds ago       Up 57 seconds (healthy)                                                                               harbor-core
d0f34ab01c10        goharbor/registry-photon:v2.6.2-v1.7.1   "/entrypoint.sh /etc…"   59 seconds ago       Up 58 seconds (healthy)            5000/tcp                                                           registry
972d20c16c94        goharbor/redis-photon:v1.7.1             "docker-entrypoint.s…"   59 seconds ago       Up 57 seconds                      6379/tcp                                                           redis
7feea19cbf09        goharbor/harbor-db:v1.7.1                "/entrypoint.sh post…"   59 seconds ago       Up 57 seconds (healthy)            5432/tcp                                                           harbor-db
632ad580657f        goharbor/harbor-adminserver:v1.7.1       "/harbor/start.sh"       59 seconds ago       Up 58 seconds (healthy)                                                                               harbor-adminserver
1b56d23e9b30        goharbor/harbor-registryctl:v1.7.1       "/harbor/start.sh"       59 seconds ago       Up 58 seconds (healthy)                                                                               registryctl
e8d9cb51673e        goharbor/harbor-log:v1.7.1               "/bin/sh -c /usr/loc…"   About a minute ago   Up 59 seconds (health: starting)   127.0.0.1:1514->10514/tcp                                          harbor-log
You can use your username and password to login that server.
Configure the Docker Insecure Service on MAC, open the docker tool on MAC
[References] —> [Daemon] —> [Insecure registries] Add my website there [ubuntu-master] —> [Apply & Restart]
> docker login ubuntu-master
Username: yiyikang
Password:
Login Succeeded
Get the latest ubuntu
> docker pull ubuntu
Tag the image
> docker tag ubuntu ubuntu-master/library/ubuntu:v1
For example, when I build my image
Successfully tagged ubuntu-master/library:kiko-jenkins-generic-jdk10
Tag again
Successfully tagged www.ubuntu-master.com/library/jenkins-generic-jdk10:1.0
I changed my domain to www.ubuntu-master.com, so redo all these steps and login again
> docker login www.ubuntu-master.com
This time it success
> docker push www.ubuntu-master.com/library/jenkins-generic-jdk10:1.0
Then we can see the docker image in UI and manage that.
Clean my local images
> docker images
> docker rmi redis:latest
Clean up the <none> tag ones
> docker images | grep none | awk '{ print $3; }' | xargs docker rmi
Command to delete all images
> docker rmi -f $(docker images -a -q)
Pull the images
> docker pull www.ubuntu-master.com/library/jenkins-generic-jdk10:1.0
How to stop the Service
> sudo docker-compose down -v

How to start the Service
>  sudo docker-compose up -d
Some details are here
https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
How to Change Config
> sudo docker-compose down -v
> sudo ./prepare
> sudo docker-compose up -d
Clean database
> rm -r /data/database
Clean the images
> rm -r /data/registry
Docker Compose
Running multiple docker containers at one single command
https://www.jianshu.com/p/0793f62af9df
https://www.jianshu.com/p/13de6b266cf8
Deal with the Ports
By default, Harbor listens on port 80 and 443 for admin portal and docker commands.
I can change the PORT in compose
> vi docker-compose.yml
I change the port from 80 to 49002
Then I change the configuration
> vi harbor.cfg
hostname = www.ubuntu-master.com:49002
Add the Host to our list in Insecure registries
www.ubuntu-master.com:49002
> docker login www.ubuntu-master.com:49002
Tag my new Image again
Successfully tagged www.ubuntu-master.com:49002/library/jenkins-generic-jdk10:1.0
Push again
> docker push www.ubuntu-master.com:49002/library/jenkins-generic-jdk10:1.0

References:
https://alexanderzeitler.com/articles/deploying-a-private-secured-docker-registry-within-15-minutes/
https://github.com/goharbor/harbor
https://dongbo0737.github.io/2017/06/29/harbor-install/
https://www.jianshu.com/p/cf16763942d5
http://blog.51cto.com/slitobo/2323332
http://www.ywnds.com/?p=7958
https://blog.csdn.net/yjk13703623757/article/details/79962616
https://blog.csdn.net/fighterandknight/article/details/72518042
https://ivanzz1001.github.io/records/post/docker/2018/04/11/docker-harbor-uage
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics