2 # SPDX-license-identifier: Apache-2.0
4 # ******************************
5 # Script to update the docker host configuration
6 # to enable Docker Remote API
7 # ******************************
9 if [ -f /etc/lsb-release ]; then
10 #tested on ubuntu 14.04 and 16.04
11 if grep -q "#DOCKER_OPTS=" "/etc/default/docker"; then
12 cp /etc/default/docker /etc/default/docker.bak
13 sed -i 's/^#DOCKER_OPTS.*$/DOCKER_OPTS=\"-H unix:\/\/\/var\/run\/docker.sock -H tcp:\/\/0.0.0.0:2375\"/g' /etc/default/docker
15 echo DOCKER_OPTS=\"-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375\" >> /etc/default/docker
17 service docker restart
18 #docker start $(docker ps -aq)
19 elif [ -f /etc/system-release ]; then
21 if grep -q "ExecStart=\/usr\/bin\/docker-current daemon" "/lib/systemd/system/docker.service"; then
22 cp /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak
23 sed -i 's/^ExecStart=.*$/ExecStart=\/usr\/bin\/docker daemon -H tcp:\/\/0.0.0.0:2375 -H unix:\/\/\/var\/run\/docker.sock \\/g' /lib/systemd/system/docker.service
24 systemctl daemon-reload
25 systemctl restart docker
27 echo "to be implemented"
30 echo "OS is not supported"
33 # Issue Note for Ubuntu
34 # 1. If the configuration of the file /etc/default/docker does not take effect after restarting docker service,
35 # you may try to modify /lib/systemd/system/docker.service
37 # cp /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak
38 # sed -i '/^ExecStart/i\EnvironmentFile=-/etc/default/docker' /lib/systemd/system/docker.service
39 # sed -i '/ExecStart=\/usr\/bin\/dockerd/{;s/$/ \$DOCKER_OPTS/}' /lib/systemd/system/docker.service
40 # systemctl daemon-reload
41 # service docker restart
42 # 2. Systemd is a system and session manager for Linux, where systemctl is one tool for systemd to view and control systemd.
43 # If the file /lib/systemd/system/docker.service is modified, systemd has to be reloaded to scan new or changed units.
44 # 1) systemd and related packages are available on the PPA. To use the PPA, first add it to your software sources list as follows.
45 # add-apt-repository ppa:pitti/systemd
47 # 2) system can be installed from the PPS as follows.
48 # apt-get install systemd libpam-systemd systemd-ui