zoukankan      html  css  js  c++  java
  • 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:



  • 相关阅读:
    【车】平安车险费用
    【光环国际】掌握项目经理12个工作流程
    【光环国际】500强公司7个项目管理工具
    数据仓库和商业智能演进五个阶段
    【技术与商业案例解读笔记】095:Google大数据三驾马车笔记
    15道最常考的SpringBoot面试题,你都遇到过哪些?
    用户画像4:标签数据开发
    plsql 传参
    shell专题(二):Shell解析器
    shell专题(三):Shell脚本入门
  • 原文地址:https://www.cnblogs.com/yanshaoshuai/p/11575701.html
Copyright © 2011-2022 走看看