首页 > 其他 > 详细

docker,docker-compose,harbor安装

时间:2019-09-23 23:59:55      阅读:203      评论:0      收藏:0      [点我收藏+]

 

安装docker-ce

下载docker-ce.repo:

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

编辑docker-ce.repo:

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:

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

安装harbor

下载安装:

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:

http://192.168.1.5

密码:admin/Harbor12345

在harbor文件下因为docker-compose.yml的存在,所以可以通过docker-compose命令来控制harbor的启动与关闭,下面docker-compose命令都可以在此文件夹下生效:

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。

向仓库提交镜像

创建用户:

技术分享图片

退出用新用户登录之后创建项目:

技术分享图片

 

 

 本地镜像打标记:

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:
技术分享图片

 

 

 

 



 

docker,docker-compose,harbor安装

原文:https://www.cnblogs.com/yanshaoshuai/p/11575701.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!