docker,docker-compose,harbor安裝

 

安裝docker-ce

下載docker-ce.repo:linux

wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo

編輯docker-ce.repo:docker

vim /etc/yum.repos.d/docker-ce.repo

:%s#download.docker.com#mirrors.tuna.tsinghua.edu.cn/docker-ce#g
:wq

yum install docker-ce -y

啓動docker:json

systemctl start docker

安裝docker-compose

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum install docker-compose -y

安裝harborvim

下載安裝:centos

wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.0.tgz
tar xf harbor-offline-installer-v1.9.0.tgz -C /usr/local
#編輯 
vim harbor.yml 
hostname: 192.168.1.5
./install.sh

訪問harbor:api

http://192.168.1.5ui

密碼:admin/Harbor12345google

在harbor文件下由於docker-compose.yml的存在,因此能夠經過docker-compose命令來控制harbor的啓動與關閉,下面docker-compose命令均可以在此文件夾下生效:spa

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information

好比能夠經過 docker-compoe start來啓動harbor。rest

向倉庫提交鏡像

建立用戶:

退出用新用戶登陸以後建立項目:

 

 

 本地鏡像打標記:

docker pull busybox

docker tag busybox 192.168.1.5/myproject/mybusybox:v0.1

編輯/etc/docker/daemon.json添加一行信任規則:

"insecure-registries": ["192.168.1.5"]

登陸並推送:

docker login 192.168.1.5
docker push 192.168.1.5/myproject

而後在harbor上就能夠看到咱們推送的鏡像了:

 

 

 刪除鏡像並從harbor上拉取:

docker rmi 192.168.1.5/myproject/mybusybox:v0.1
docker pull 192.168.1.5/myproject/mybusybox:v0.1

docker images:

相關文章
相關標籤/搜索