DOCKER_OPTS do not work in config file /etc/default/docker

前端 未结 9 996
野性不改
野性不改 2020-12-13 09:59

I have changed /etc/default/docker with DOCKER_OPTS=\"-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock\" (docker version 1.4.1 in ubuntu 14.0

9条回答
  •  长情又很酷
    2020-12-13 10:27

    In reply to the systemd comments in combination with Ubuntu: Ubuntu 14.04 still uses Upstart, so the changes to /etc/default/docker should have had the desired effect. It isn't until 15.04 that Ubuntu started using systemd by default.

    In case you have Ubuntu 15.04 or later and thus need to use systemd, or if you explicitly choose to use systemd before 15.04, the correct and simplest way to get the desired effect of the OP, a TCP socket, would be:

    1. Create the file /etc/systemd/system/docker.service.d/docker-tcp.conf
    2. Add the contents below
    3. Execute sudo systemctl daemon-reload
    4. Execute sudo systemctl restart docker

    File contents:

    [Service]
    ExecStart=
    ExecStart=/usr/bin/docker daemon --host=tcp://127.0.0.1:2375
    

提交回复
热议问题