From 624040c9a3626b1b28d99d50c662a84b81fffbdc Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Fri, 20 Oct 2023 11:09:16 +0200 Subject: [PATCH] Make the userland proxy disabling more user friendly --- docker_db.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docker_db.sh b/docker_db.sh index 17aa54a03a..7c80977c64 100755 --- a/docker_db.sh +++ b/docker_db.sh @@ -619,15 +619,25 @@ EOF\"" disable_userland_proxy() { if [[ "$HEALTCHECK_PATH" == "{{.State.Health.Status}}" ]]; then - if ! sudo test -f /etc/docker/daemon.json; then + if [[ ! -f /etc/docker/daemon.json ]]; then + echo "Didn't find /etc/docker/daemon.json but need to disable userland-proxy..." + echo "Stopping docker..." sudo service docker stop + echo "Creating /etc/docker/daemon.json..." sudo bash -c "echo '{\"userland-proxy\": false}' > /etc/docker/daemon.json" + echo "Starting docker..." sudo service docker start - elif ! sudo grep -q userland-proxy /etc/docker/daemon.json; then + echo "Docker successfully started with userland proxies disabled" + elif ! grep -q userland-proxy /etc/docker/daemon.json; then + echo "Userland proxy is still enabled in /etc/docker/daemon.json, but need to disable it..." export docker_daemon_json=$( /etc/docker/daemon.json' + echo "Starting docker..." sudo service docker start + echo "Docker successfully started with userland proxies disabled" fi fi }