下载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
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: