Where is /etc/default/docker file on Amazon Linux EC2 server?

Viewed 4602

I am trying docker examples and wanted to set the DOCKER_OPTS, but not able to find /etc/default/docker on amazon linux machine. Where to look for it?

3 Answers

Adding DOCKER_OPTS to /etc/sysconfig/docker will not work in Amazon Linux 2.

You will see this when watching the logs.

journalctl -u docker.service

Jan 17 08:11:07 portal-staging-new systemd[1]: Starting Docker Application Container Engine...
Jan 17 08:11:07 portal-staging-new systemd[1]: Ignoring invalid environment assignment 'DOCKER_OPTS=
Jan 17 08:11:07 portal-staging-new systemd[1]:     --cluster-advertise=eth0:2375
Jan 17 08:11:07 portal-staging-new systemd[1]:     --cluster-store=consul://consul:8500
Jan 17 08:11:07 portal-staging-new systemd[1]:     --host tcp://0.0.0.0:2375
Jan 17 08:11:07 portal-staging-new systemd[1]:     --host unix:///var/run/docker.sock
Jan 17 08:11:07 portal-staging-new systemd[1]:     --log-driver=gelf
Jan 17 08:11:07 portal-staging-new systemd[1]:     --log-opt gelf-address=udp://127.0.0.1:1513
Jan 17 08:11:07 portal-staging-new systemd[1]:     --log-opt tag=docker
Jan 17 08:11:07 portal-staging-new systemd[1]:     --userland-proxy=false
Jan 17 08:11:07 portal-staging-new systemd[1]: ': /etc/sysconfig/docker

So you will need to add the config to /etc/docker/daemon.json.

Related