docker,docker-compose,harbor安装

 

安装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:

 

 

 

 



 

posted @ 2019-09-23 23:41  天涯屐痕  阅读(526)  评论(0编辑  收藏  举报