• centos7 docker install


    env:     

        os :centos 7

        vmware

    steps:

          1.yum  -y install docker

              after installed ,using   docker version cmd to check if docker installed success or not

          2.service docker start

          3. common  cmd

            docker images

            docker ps 

           docker ps -a

          docker pull

         docker push 

        docker run  

        docker  run  -v -p 

       docker rmi  删镜像

       docker rm  删容器

      4.向私有库 push 镜像时

          提示: 

    docker push 192.168.179.132:5000/busybox
    The push refers to a repository [192.168.179.132:5000/busybox]
    Get https://192.168.179.132:5000/v1/_ping: http: server gave HTTP response to HTTPS client

       解决办法:   新版本跟私服交互默认采用https协议,私服一般就只有http。所以需要添加在客户端docker环境 添加 私服的信任。

    从docker1.3.2版本开始默认docker registry使用的是https,当你用docker pull 非https的docker regsitry的时候会报下面错误:
    Java代码  收藏代码
    Error: Invalid registry endpoint ... Get ... If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add '--insecure-registry 192.168.1.103:5000' to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/192.168.1.103:5000/ca.crt  
     
    解决方案:
    Java代码  收藏代码
    vi /usr/lib/systemd/system/docker.service  
     
    内容修改如下:
    Java代码  收藏代码
    [Unit]  
    Description=Docker Application Container Engine  
    Documentation=http://docs.docker.com  
    After=network.target docker.socket  
    Requires=docker.socket  
      
    [Service]  
    Type=notify  
    EnvironmentFile=-/etc/sysconfig/docker  
    EnvironmentFile=-/etc/sysconfig/docker-storage  
    ExecStart=/usr/bin/docker -d --insecure-registry 192.168.1.103:5000  -H fd:// $OPTIONS $DOCKER_STORAGE_OPTIONS  
    LimitNOFILE=1048576  
    LimitNPROC=1048576  
      
    [Install]  
    WantedBy=multi-user.target  

      

    下面忽略: 当晚安装 无法pull下来image 但是第二天早上就可以了

    修改Docker配置文件/etc/default/docker如下:

    DOCKER_OPTS="--registry-mirror=https://o3trwnyj.mirror.aliyuncs.com"
    

    使用service docker restart重启Docker服务即可。

    如果想使用国内镜像  如阿里(安装 curl那块就没通过)

        建议  按阿里推荐的方式安装

          

    安装/升级你的Docker客户端

    推荐安装1.10.0以上版本的Docker客户端。

    您可以通过阿里云的镜像仓库下载:docker-enginedocker-ce

    或执行以下命令:

    curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
    

    如何使用Docker加速器

    针对Docker客户端版本大于1.10的用户

    您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器:

    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://o3trwnyj.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  • 相关阅读:
    SDN大作业
    第06组 Beta版本演示
    SqlServer 将多行字段合并成单行
    C# MD5加密字符串
    Request.IsAjaxRequest()总是返回false
    Mybatis 语句包含单引号的写法
    idea每次启动maven项目都貌似读不到配置
    idea下springboot项目配置文件application.properties不生效的问题
    Ubuntu 设置时区
    SpringBoot 使用MyBatis
  • 原文地址:https://www.cnblogs.com/hutuchong/p/7748288.html
Copyright © 2020-2023  润新知