新版本的docker再次审判了我们,对于需要自建私有仓库的朋友们需要注意下面的说明。
这个是新启动的docker
root@docker:/opt/software/DOCKER-FILES/elasticsearch# ps -ef | grep dockerroot 3854 1 0 Jan05 ? 00:00:00 /usr/bin/python /usr/local/bin/gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/error.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 192.168.0.240:5000 -w 1 docker_registry.wsgi:applicationroot 3859 3854 0 Jan05 ? 00:00:03 /usr/bin/python /usr/local/bin/gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/error.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 192.168.0.240:5000 -w 1 docker_registry.wsgi:applicationroot 6298 1 4 02:29 ? 00:00:00 /usr/bin/dockerd -H fd://root 6305 6298 0 02:29 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
修改
EnvironmentFile=/etc/default/docker
ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTSroot@docker:/opt/software/DOCKER-FILES/elasticsearch# vim /lib/systemd/system/docker.service[Unit]Description=Docker Application Container EngineDocumentation=https://docs.docker.comAfter=network.target docker.socketRequires=docker.socket[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 dockerEnvironmentFile=/etc/default/dockerExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTSExecReload=/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=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226 and above support this version.TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process[Install]WantedBy=multi-user.target
修改/etc/default/docker
root@docker:/opt/software/DOCKER-FILES/elasticsearch# vim /etc/default/docker# Docker Upstart and SysVinit configuration file## THIS FILE DOES NOT APPLY TO SYSTEMD## Please see the documentation for "systemd drop-ins":# https://docs.docker.com/engine/articles/systemd/## Customize location of Docker binary (especially for development testing).#DOCKERD="/usr/local/bin/dockerd"# Use DOCKER_OPTS to modify the daemon startup options.#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"DOCKER_OPTS="--insecure-registry 192.168.0.240"# If you need Docker to use an HTTP proxy, it can also be specified here.#export http_proxy="http://127.0.0.1:3128/"# This is also a handy place to tweak where Docker's temporary files go.#export TMPDIR="/mnt/bigdrive/docker-tmp
重启docker
root@docker:/opt/software/DOCKER-FILES/elasticsearch# /etc/init.d/docker restart[....] Restarting docker (via systemctl): docker.serviceWarning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.. ok root@docker:/opt/software/DOCKER-FILES/elasticsearch# systemctl daemon-reloadroot@docker:/opt/software/DOCKER-FILES/elasticsearch# ps -ef | grep dockerroot 3854 1 0 Jan05 ? 00:00:00 /usr/bin/python /usr/local/bin/gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/error.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 192.168.0.240:5000 -w 1 docker_registry.wsgi:applicationroot 3859 3854 0 Jan05 ? 00:00:03 /usr/bin/python /usr/local/bin/gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/error.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 192.168.0.240:5000 -w 1 docker_registry.wsgi:applicationroot 6453 1 2 02:30 ? 00:00:00 /usr/bin/dockerd -H fd:// --insecure-registry 192.168.0.240root 6460 6453 0 02:30 ? 00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runcroot 6580 3972 0 02:30 pts/2 00:00:00 grep --color=auto docker
这样环境变量就生效了