zoukankan      html  css  js  c++  java
  • Docker私有仓库的构建

    [root@localhost ~]# vim /etc/sysconfig/docker

    #INSECURE_REGISTRY='--insecure-registry'

    INSECURE_REGISTRY='--insecure-registry 192.168.30.24:5000'

    [root@localhost ~]# systemctl restart docker

    下载镜像

    [root@localhost ~]# docker search -s 100 registry

    [root@localhost ~]# docker pull docker.io/registry

    [root@localhost ~]# mkdir -pv /opt/data/registry

    mkdir: 已创建目录 "/opt/data"

    mkdir: 已创建目录 "/opt/data/registry"

    查看镜像

    [root@localhost ~]# docker images

    REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE

    docker.io/nginx      latest              53f3fd8007f7        4 days ago          109 MB

    docker.io/registry   latest              f32a97de94e1        2 months ago        25.8 MB

    运行容器

    [root@localhost ~]# docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry registry

    a75135211fb3fc62450fb6e051a9c63b812d2e1c9719ca72ef3e5c48e55f486f

    [root@localhost ~]# docker ps -a

    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS                    NAMES

    a75135211fb3        registry            "/entrypoint.sh /e..."   18 seconds ago      Up 17 seconds               0.0.0.0:5000->5000/tcp   upbeat_gates

    9b38a1021078        docker.io/nginx     "/bin/bash"              2 hours ago         Exited (0) 19 minutes ago                            stoic_goldwasser

    c8931c0b8359        docker.io/nginx     "/bin/bash"              2 hours ago         Exited (0) 19 minutes ago                            kind_booth

    启动容器

    [root@localhost ~]# docker start a7

    a7

    [root@localhost ~]# docker ps

    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES

    a75135211fb3        registry            "/entrypoint.sh /e..."   56 seconds ago      Up 54 seconds       0.0.0.0:5000->5000/tcp   upbeat_gates

    [root@localhost ~]# docker tag nginx 192.168.30.24:5000/nginx-test

    [root@localhost ~]# docker images

    192.168.30.24:5000/nginx-test   latest              53f3fd8007f7        4 days ago          109 MB

    [root@localhost ~]# docker push 192.168.30.24:5000/nginx-test

    在另一台机器然后上传过来

    [root@elk-node2 ~]# docker pull 192.168.30.24:5000/nginx-test

    [root@elk-node2 ~]# docker images

    REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE

    nginx                           new                 db02b5df51bf        24 minutes ago      393 MB

    192.168.30.24:5000/nginx-test   latest              53f3fd8007f7        4 days ago          109 MB

    centos                          7                   9f38484d220f        8 weeks ago         202 MB

    docker.io/centos                latest              9f38484d220f        8 weeks ago         202 MB

  • 相关阅读:
    自编游戏
    宣言
    Leetcode: 12. Integer to Roman
    Leetcode: 11. Container With Most Water
    Leetcode: 10. Regular Expression Matching
    网络编程:listen函数
    网络编程:connect函数
    Leetcode: 9. Palindrome Number
    Leetcode: 8. String to Integer (atoi)
    Leetcode: 7. Reverse Integer
  • 原文地址:https://www.cnblogs.com/zc1741845455/p/10943939.html
Copyright © 2011-2022 走看看