docker配置

docker私服配置

1、修改docker配置文件

/etc/systemd/system/multi-user.target.wants/docker.service

 2、添加docker私服地址:

ExecStart=/usr/bin/dockerd-current \
          --insecure-registry localhost:8082 \
          --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
          --default-runtime=docker-runc \
          --exec-opt native.cgroupdriver=systemd \
          --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
          $OPTIONS \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $ADD_REGISTRY \

 3、重启docker服务

[root@bogon docker]# systemctl daemon-reload
[root@bogon docker]# systemctl restart docker

 4、上传镜像

4.1 登陆

docker login 127.0.0.1:8081

4.2 打版本

docker tag jlcon/firstdocker localhost:8082/jlcon/firstdocker:latest

4.3 上传镜像

docker push localhost:8082/jlcon/firstdocker:latest

4.4 查找镜像

docker search localhost:8082/jlcon/firstdocker

启用docker远程访问

编辑:

vim /etc/sysconfig/docker-network

 内容:

DOCKER_NETWORK_OPTIONS="-H unix:///var/run/docker.sock -H 0.0.0.0:<端口>"

 重启docker服务:

systemctl daemon-reload
systemctl restart docker.service

docker命令集

1、删除停止状态容器

docker rm `docker ps -a |awk '{print $1}' | grep [0-9a-z]`

相关推荐