Solve the invalid/etc/default/docker issue in debian8, debian8docker

Source: Internet
Author: User

Solve the invalid/etc/default/docker issue in debian8, debian8docker

Environment: Debian 8 + Docker 1.6

  • The DOCKER_OPTS parameter in/etc/default/docker is invalid.
  • /Etc/default/docker didn't work
  • DOCKER_OPTS do not work

At the beginning, I just wanted to add a registry--insecure-registry= the startup parameter of docker daemon. In/etc/default/dockerAddDOCKER_OPTS="$DOCKER_OPTS --insecure-registry="In this way, set the DOCKER_OPTS parameter. Then restart docker with service or systemctl.

However, it does not work at all. Docker client fails to access the registry because of tls. If you view docker startup parameters:

➜  ~  ps -ef | grep dockerroot      11085      1  0 20:32 ?        00:00:00 /usr/bin/docker -d -H fd://angryro+  11148   1554  0 20:33 pts/1    00:00:00 grep --color=auto docker

The DOCKER_OPTS parameter is not read at all. Find this issue on github. The operating system is also debian and docker 1.6.2. The reason is:/lib/systemd/system/docker.serviceThe EnvironmentFile variable is not set at all, meaning/etc/docker/default is not read at all. The modification method in issue is: Modify/lib/systemd/system/docker.service:

[Unit] Description = Docker Application Container EngineDocumentation = http://docs.docker.comAfter routing network.tar get docker. socketRequires = docker. socket [Service] EnvironmentFile =-/etc/default/docker # The EnvironmentFile parameter ExecStart =/usr/bin/docker-d $ DOCKER_OPTS-H fd is added here: // # added the batch get

After the EnvironmentFile variable =-Indicates ignore_errors = yes,$DOCKER_OPTSAdding to ExecStart should mean letting systemd put EnvironmentFile$DOCKER_OPTSAs the docker startup parameter. However, this does not work for me. If you are successful, please let me know. The cause of the error is$DOCKER_OPTSIt seems that it has not been resolved. docker directly uses/usr/bin/docker -d $DOCKER_OPTS -H fd://Start, instead/usr/bin/docker -d --insecure-registry= -H fd://So docker will have an error of startup.

$ Ps-ef | grep docker # Check whether docker is started and the startup parameters $ sudo systemctl status docker # view docker startup status $ sudo journalctl-u docker # view docker startup logs

Here, we can see the docker documentation on systemd, which is actually used here.$OPTIONSThe example of parameter startup is persistent at the time. The result is displayed on a stackoverflow$OPTIONSStarted. Write down the following Debugging commands:

$ sudo systemctl show docker | grep EnvironmentFileEnvironmentFile=-/etc/sysconfig/docker (ignore_errors=yes)$ sudo systemctl status docker | grep Loaded   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)$ sudo grep EnvironmentFile /usr/lib/systemd/system/docker.serviceEnvironmentFile=-/etc/default/docker

In/etc/default/dockerUse the OPTIONS Option and modify it accordingly./lib/systemd/system/docker.service:

➜  ~  cat /etc/default/docker      # Docker Upstart and SysVinit configuration file# Customize location of Docker binary (especially for development testing).#DOCKER="/usr/local/bin/docker"# Use DOCKER_OPTS to modify the daemon startup options.#DOCKER_OPTS="--dns --dns"# If you need Docker to use an HTTP proxy, it can also be specified here.#export http_proxy=""# This is also a handy place to tweak where Docker's temporary files go.#export TMPDIR="/mnt/bigdrive/docker-tmp"OPTIONS=--insecure-registry➜  ~  cat /lib/systemd/system/docker.service [Unit]Description=Docker Application Container EngineDocumentation= docker.socketRequires=docker.socket[Service]EnvironmentFile=-/etc/default/dockerExecStart=/usr/bin/docker -d -H fd:// $OPTIONSMountFlags=slaveLimitNOFILE=1048576LimitNPROC=1048576LimitCORE=infinity[Install]➜  ~  sudo systemctl daemon-reload ➜  ~  sudo systemctl restart docker➜  ~  ps -ef | grep dockerroot       5516      1 40 21:10 ?        00:00:02 /usr/bin/docker -d -H fd:// --insecure-registry   5552   1573  0 21:10 pts/0    00:00:00 grep --color=auto docker

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.