docker配置私有仓库
配置docker的这个文件/etc/docker/daemon.json后出错或者修改docker.service之后。修改此文件后重新加载
systemctl daemon-reload 加载配置文件。使其生效
systemctl start docker 重启
问题原因: 是因为docker.service 这个文件中配置的启动参数和daemon.json的参数冲突了
Job for docker.service failed because the control process exited with error code. See “sys temctl status docker.service” and “journalctl -xe” for details.
一定要分清楚自己电脑上的docker.service的位置,有的在usr下,有的在、ect/systemd/system/下。
docker.service的
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
用于指定启动参数,参数不能和daemon.json的重复。我就是重复报错。
Dec 05 11:54:15 contosnodedou dockerd[23207]: unable to configure the Docker daemon with file /et
Dec 05 11:54:15 contosnodedou systemd[1]: docker.service: main process exited, code=exited, statu
Dec 05 11:54:15 contosnodedou systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Dec 05 11:54:15 contosnodedou systemd[1]: Unit docker.service entered failed state.
Dec 05 11:54:15 contosnodedou systemd[1]: docker.service failed.
Dec 05 11:54:15 contosnodedou systemd[1]: docker.service holdoff time over, scheduling restart.
Dec 05 11:54:15 contosnodedou systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has finished shutting down.
Dec 05 11:54:15 contosnodedou systemd[1]: start request repeated too quickly for docker.service
Dec 05 11:54:15 contosnodedou systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Dec 05 11:54:15 contosnodedou systemd[1]: Unit docker.service entered failed state.
Dec 05 11:54:15 contosnodedou systemd[1]: docker.service failed.
如果还是启动不了,只能重新安装
docker上传私有仓库步骤
docker images //查看所有镜像
docker tag images中的镜像id 私有仓库的ip:port/镜像名:新的tag
docker push 私有仓库的ip:port/镜像名:新的tag //长传自己的镜像
docker pull 私有仓库的ip:port/镜像名:新的tag //其他拉去。。。
- 删除指定容器
docker rm -f - 删除未启动成功的容器
docker rm $(docker ps -a|grep Created|awk ‘{print $1}’)
或者
docker rm $(docker ps -qf status=created) - 删除退出状态的容器
docker rm $(docker ps -a|grep Exited|awk ‘{print $1}’)
或者
docker rm $(docker ps -qf status=exited) - 删除所有未运行的容器
docker rm $(docker ps -a -q) #正在运行的删除不了,所有未运行的都被删除了
或者
docker container prune #Docker 1.13版本以后,可以使用 docker containers prune 命令,删除孤立的容器
本文来自博客园,作者:doufei,转载请注明原文链接:https://www.cnblogs.com/lfdou/p/17412926.html