can we update docker default configure?

3/8/2016

require:

I need change the "LogConfig" type to syslog.

I known this can be working:

docker run --log-driver=syslog

but, I start container by k8s in cluster now.How to configure the LogConfig? or how to change it`s default to syslog?


Thanks @Jan Garaj and @molivier

this is my docker version

[root@ip-hostname ~]# docker version
Client:
 Version:      1.8.2-el7.centos
 API version:  1.20
 Package Version: docker-1.8.2-10.el7.centos.x86_64
 Go version:   go1.4.2
 Git commit:   a01dc02/1.8.2
 Built:
 OS/Arch:      linux/amd64

Server:
 Version:      1.8.2-el7.centos
 API version:  1.20
 Package Version:
 Go version:   go1.4.2
 Git commit:   a01dc02/1.8.2
 Built:
 OS/Arch:      linux/amd64

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service

This configure:

[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
ExecStart=/usr/bin/docker daemon $OPTIONS='--log-driver=syslog' \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $ADD_REGISTRY \
          $BLOCK_REGISTRY \
          $INSECURE_REGISTRY
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
MountFlags=slave
TimeoutStartSec=1min
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then:

systemctl daemon-reload

systemctl restart docker

Look like not working...

docker inspect 7fa2e28203b1

 "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "CgroupParent": "",
        "ConsoleSize": [
            0,
            0
        ]

please help...

-- david guo
configure
docker
kubernetes

1 Answer

3/8/2016

You can adjust the docker default configuration in /etc/default/docker (daemon):

DOCKER_OPTS='
-H tcp://0.0.0.0:2376
-H unix:///var/run/docker.sock
--storage-driver aufs
.../...
--log-driver=syslog
'

Have a look to configuring docker.

Edit: As mentionned by Jan Garaj (issue 9889) the /etc/default/docker file is only used on systems using "upstart" and "SysVInit", not on systems using systemd (see systemd config).

-- molivier
Source: StackOverflow