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

前端 未结 9 993
野性不改
野性不改 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:40

    After checking docker source code (config.go and flags.go), I would say that the options you can pass in $DOCKER_OPTS are options for docker itself, and -H or --host is an option for docker daemon. As a workaround to solve your problem, you can edit the init script file you are using to include the -H option there. For example:

    • If you are using upstart init system, edit the file /etc/init/docker.conf changing the exec line with exec "$DOCKER" -H "tcp://127.0.0.1:2375" -H "unix:///var/run/docker.sock" -d $DOCKER_OPTS
    • If you are using sysvinit init system, edit the file /etc/init.d/docker changing the starting lines with something like:

    Use this command:

    start-stop-daemon --start --background \
        --no-close \
        --exec "$DOCKER" \
        --pidfile "$DOCKER_SSD_PIDFILE" \
        --make-pidfile \
        -- \
            -H "tcp://127.0.0.1:2375" \
            -H "unix:///var/run/docker.sock" \
            -d -p "$DOCKER_PIDFILE" \
            $DOCKER_OPTS >> \
            "$DOCKER_LOGFILE" 2>&1 
        log_end_msg $?
        ;;
    

提交回复
热议问题