zoukankan      html  css  js  c++  java
  • docker安装和hub

    yum install wget
    wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    yum list docker-ce --showduplicates|sort -r
    yum install docker-ce docker-ce-cli containerd.io
    systemctl start docker
    systemctl status docker -l
    docker run hello-world
    systemctl enable docker
    
    =======================
    
    docker info
    
    =======================
    这就是完整的过程
    编辑dockerfile文件》登录公共registry》build》本地运行》推送》其它机器拉取
    
    
    cat > Dockerfile <<EOF
    FROM busybox
    CMD echo "Hello world! This is my first Docker image."
    EOF
    
    docker login
    如果没有打a1这个标签,默认就是latest
    docker build -t createyuan/my-first:a1 .
    最后要加上一个dockerfile文件的路径,在当前目录下,也要指定./,不然报错
    
    加速一下(配置国内镜像站点),不然会报TLS handshake timeout错误
    echo "DOCKER_OPTS="--registry-mirror=https://registry.docker-cn.com"" >> /etc/default/docker
    
    systemctl status docker -l
    systemctl restart docker
    systemctl status docker -l
    
    docker build -t createyuan/my-first:a1 .
    docker run createyuan/my-first:a1
    
    有时推送不成功,多试几次,试了三次
    第一次net/http: TLS handshake timeout
    第二次read tcp 192.168.7.201:41794->104.18.124.25:443: read: connection reset by peer
    第三次a1: digest: sha256:5738039995376e9eac8be145ffde81fe5781f6385406cd2c2deb7352e940369e size: 527
    
    docker push createyuan/my-first:a1
    
    The push refers to repository [docker.io/createyuan/my-first]
    d1156b98822d: Mounted from library/busybox
    a1: digest: sha256:5738039995376e9eac8be145ffde81fe5781f6385406cd2c2deb7352e940369e size: 527
    
    =========================
    删除本地的镜像
    docker image ls
    docker rmi -f e3303b21e364
    或者
    docker rmi -f createyuan/my-first:a1
    
    Untagged: createyuan/my-first:a1
    Untagged: createyuan/my-first@sha256:5738039995376e9eac8be145ffde81fe5781f6385406cd2c2deb7352e940369e
    Deleted: sha256:e3303b21e364adb0df734ac558f07cfcaeab1e4d6a5db87d4b03fcd90a2d37bb
    
    运行,结果就是重新拉取镜像
    docker run createyuan/my-first:a1
    Unable to find image 'createyuan/my-first:a1' locally
    a1: Pulling from createyuan/my-first
    53071b97a884: Already exists
    Digest: sha256:5738039995376e9eac8be145ffde81fe5781f6385406cd2c2deb7352e940369e
    Status: Downloaded newer image for createyuan/my-first:a1
    Hello world! This is my first Docker image.
    =============================
    构建第二个版本
    docker build -t createyuan/my-first:a2 .
    推送第二个版本
    docker push createyuan/my-first:a2
    运行
    docker run createyuan/my-first:a2

     

  • 相关阅读:
    element-ui分页组件修改当前页current-page后current-change事件不触发
    使用element-ui 的table 组件 表格线条不对齐
    vue 禁止浏览器自带的后退功能
    echart 柱图的(层叠柱图和柱图)label只显示总数 ,折线图的legent上显示总数
    element-ui table组件,分别设置表头和表格内容的居中,自定义渲染
    vue-cli-3+element-ui 按需引入element-ui的配置
    今天使用ElementUI与vue-quill-editor的时候发现,富文本编辑框选项对齐出现了点问题。
    vue-router 切换页面的时候,页面没有请求,
    msvcp140.dll缺失解决办法
    CTF中RSA题目的pem文件处理
  • 原文地址:https://www.cnblogs.com/createyuan/p/10888519.html
Copyright © 2011-2022 走看看