美文网首页docker
Portus register仓库使用

Portus register仓库使用

作者: mr_xm | 来源:发表于2017-10-19 19:18 被阅读0次

    #register搭建及使用说明

    ## 1、搭建参考 搭建指导

    ## 2、使用:由于这个是个私有镜像仓库,所要在其他机器上使用这个仓库,需要配置/etc/hosts

    ```Bash

    vim /etc/hosts

    172.20.2.93 xxxx.sz.test-portus.com

    ```

    ## 3、需要配置dockerd的启动项docker.service文件:

    ```Bash

    [Unit]

    Description=Docker Application Container Engine

    Documentation=https://docs.docker.com

    After=network-online.target firewalld.service

    Wants=network-online.target

    [Service]

    Type=notify

    # the default is not to use systemd for cgroups because the delegate issues still

    # exists and systemd currently does not support the cgroup feature set required

    # for containers run by docker

    ExecStart=/usr/bin/dockerd --insecure-registry=xxxx.test-portus.com

    ExecReload=/bin/kill -s HUP $MAINPID

    # Having non-zero Limit*s causes performance problems due to accounting overhead

    # in the kernel. We recommend using cgroups to do container-local accounting.

    LimitNOFILE=infinity

    LimitNPROC=infinity

    LimitCORE=infinity

    # Uncomment TasksMax if your systemd version supports it.

    # Only systemd 226 and above support this version.

    #TasksMax=infinity

    TimeoutStartSec=0

    # set delegate yes so that systemd does not reset the cgroups of docker containers

    Delegate=yes

    # kill only the docker process, not all processes in the cgroup

    KillMode=process

    # restart the docker process if it exits prematurely

    Restart=on-failure

    StartLimitBurst=3

    StartLimitInterval=60s

    [Install]

    WantedBy=multi-user.target

    ```

    k8s集群的话需要修改options:

    ```Bash

    /etc/systemd/system/docker.service.d

    vim docker-options.conf 添加需要加入的repo

    [Service]

    Environment="DOCKER_OPTS=--insecure-registry=10.96.0.0/16 --insecure-registry=xxxx.test-portus.com --graph=/var/lib/docker \

    --iptables=true"

    ```

    重启docker服务

    ```Bash

    systemctl daemon-reload

    systemctl restart docker.service

    ```

    ## 4、本地push 镜像,push到xxxx.test-portus.com/public/路径下;

    修改一个镜像的tag,使用common-ops账号xxxx密码登陆registry;

    ```Bash

    docker tag busybox:latest xxxx.test-portus.com/public/busybox:test

    docker login -ucommon-ops -pxxxx xxxx.test-portus.com

    docker push xxxx.test-portus.com/public/busybox:test

    删除

    docker rmi xxxx.test-portus.com/public/busybox:test

    拉去

    docker pull xxxx.test-portus.com/public/busybox:test

    ```

    通过window可以访问https://xxxx.test-portus.com 页面上可以查看到刚刚上传的镜像。

    相关文章

      网友评论

        本文标题:Portus register仓库使用

        本文链接:https://www.haomeiwen.com/subject/jwjpuxtx.html