Commit 793cef66 authored by Emeric Verschuur's avatar Emeric Verschuur

[env-setup/ubuntu] [Fix] read empty or invalid daemon.json

parent 233e8a11
......@@ -75,7 +75,11 @@ fi
# - DNS: Use system dns instead of Google one
_sudo ip link del docker0 2>/dev/null || true
_sudo mkdir -p /etc/docker
if [ ! -s /etc/docker/daemon.json ]; then
if ! jq '' /etc/docker/daemon.json > /dev/null 2>&1; then
if [ -f /etc/docker/daemon.json ]; then
_sudo mv /etc/docker/daemon.json{,.bak}
print_warning "Invalid file /etc/docker/daemon.json, moving it to /etc/docker/daemon.json.bak"
fi
_sudo bash -c 'echo {} > /etc/docker/daemon.json'
fi
for dns in $CITBX_DOCKER_DNS_LIST; do
......@@ -87,8 +91,9 @@ for dns in $CITBX_DOCKER_DNS_LIST; do
done
# Put in comment the docker default options
_sudo grep '^ *\<DOCKER_OPTS\>' /etc/default/docker &&
_sudo sed '/^ *\<DOCKER_OPTS\>/s/^/#/' -i /etc/default/docker
if grep -q '^ *\<DOCKER_OPTS\>' /etc/default/docker; then
_sudo sed '/^ *\<DOCKER_OPTS\>/s/^/#/' -i /etc/default/docker
fi
_sudo cat /etc/docker/daemon.json |
jq ". + {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment