[
  {
    "path": "Formula/docker-machine-nfs-generic.rb",
    "content": "class DockerMachineNfsGeneric < Formula\n  desc \"Activates NFS on docker-machine (with generic driver support)\"\n  homepage \"https://github.com/sergeycherepanov/docker-machine-nfs\"\n  url \"https://github.com/sergeycherepanov/docker-machine-nfs/archive/0.5.4.2.tar.gz\"\n  sha256 \"5067da89d8ba1205883cfa0087106cbbe5bc4140ee4b9f45ed1a7b772363417b\"\n  license \"MIT\"\n  version \"0.5.4\"\n  revision 2\n\n  def install\n    bin.install \"docker-machine-nfs.sh\" => \"docker-machine-nfs-generic\"\n  end\n\n  test do\n    system \"#{bin}/docker-machine-nfs-generic\"\n  end\nend\n"
  },
  {
    "path": "Formula/docker-machine-pf.rb",
    "content": "require 'formula'\n\nclass DockerMachinePf < Formula\n  url 'https://github.com/johanhaleby/docker-machine-port-forwarder/archive/d58e7b8f267b6d9e4156f0c5939c01a84afb52ec.tar.gz'\n  homepage 'https://github.com/johanhaleby/docker-machine-port-forwarder'\n  sha256 '0acd6f61c71b4f719613c92e2b5df5231ec5d76816ef4e321c2b7c2150d1fcdf'\n  version \"0.0.1\"\n  revision 2\n\n  def install\n      bin.install \"pf\"\n  end\nend\n"
  },
  {
    "path": "Formula/docker-virtualbox.rb",
    "content": "require 'formula'\n\nclass DockerVirtualbox < Formula\n  url \"https://github.com/sergeycherepanov/homebrew-docker-virtualbox.git\", :using => :git\n  version \"0.0.7\"\n  revision 1\n\n  depends_on 'coreutils'\n  depends_on 'curl'\n  depends_on 'jq'\n  depends_on 'terminal-notifier'\n  depends_on 'docker'\n  depends_on 'docker-compose'\n  depends_on 'docker-credential-helper'\n  depends_on 'docker-machine'\n  depends_on 'docker-machine-nfs-generic'\n\n  keg_only \"this package may conflict with official docker client\"\n\n  resource \"gobetween\" do\n    url \"https://github.com/yyyar/gobetween/releases/download/0.8.0/gobetween_0.8.0_darwin_amd64.zip\"\n    sha256 \"15efec9cef9dc01c4e195042df62def95f189090e470678d5b6f024afa71e1b0\"\n  end\n\n  def install\n    resource(\"gobetween\").stage do\n      bin.install \"gobetween\"\n    end\n    (buildpath/\"gobetween.toml\").write <<~EOS\n      [api]\n      enabled = true\n      bind = \"127.0.0.1:8181\"\n    EOS\n    (etc/\"docker-virtualbox\").mkpath\n    etc.install \"gobetween.toml\" => 'docker-virtualbox/gobetween.toml'\n\n    bin.install \"bin/docker\"\n    bin.install \"bin/docker-compose\"\n    bin.install \"bin/docker-machine-init\"\n    prefix.install \"assets/djocker.png\"\n  end\n\n  def caveats\n      s = <<~EOS\n        Docker Virtualbox was installed\n\n        Please don't forget to configure your PATH variable\n      EOS\n      s\n    end\n\n    def plist; <<~EOS\n      <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n      <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n      <plist version=\"1.0\">\n      <dict>\n        <key>KeepAlive</key>\n        <true/>\n        <key>Label</key>\n        <string>#{plist_name}</string>\n        <key>ProgramArguments</key>\n        <array>\n          <string>#{opt_bin}/docker-machine-init</string>\n        </array>\n        <key>RunAtLoad</key>\n        <true/>\n        <key>WorkingDirectory</key>\n        <string>/tmp</string>\n      </dict>\n      </plist>\n    EOS\n    end\nend\n"
  },
  {
    "path": "README.md",
    "content": "# Homebrew Docker Virtualbox (Not Only for VirtualBox)\n\nThis Homebrew formula fixes Docker issues on AMD‑based macOS systems (Ryzentosh), and it also works on regular Macs using VirtualBox or other Docker Machine drivers.\n\n**Before starting:** read this notice: [https://gist.github.com/slykar/e92732be9bf81a71e08068245656d70e?permalink_comment_id=4105556#gistcomment-4105556](https://gist.github.com/slykar/e92732be9bf81a71e08068245656d70e?permalink_comment_id=4105556#gistcomment-4105556)\n\n---\n\n## 1. Install VirtualBox (Optional)\n\nDownload VirtualBox: [https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads)\n\n> Required only if you want to use the VirtualBox driver. Remove previous installations first.\n\n---\n\n## 2. VirtualBox 6.1.28+ Network Configuration\n\nIf you use VirtualBox, allow access to 192.168.99.0/8:\n\nEdit:\n\n```\nsudo nano /etc/vbox/networks.conf\n```\n\nAdd:\n\n```\n* 192.168.99.0/8\n```\n\n---\n\n## 3. Install docker‑virtualbox via Homebrew\n\n```\nbrew tap serhiicherepanov/docker-virtualbox\nbrew install docker-virtualbox\n```\n\n---\n\n## 4. Configure docker‑virtualbox Requirements\n\nThese require root permissions:\n\nEnsure NFS exports file exists:\n\n```\nsudo touch /etc/exports\n```\n\nAllow the `staff` group necessary permissions:\n\n```\nsudo tee /etc/sudoers.d/docker-machine-nfs <<SUDOERS\n%staff ALL=(ALL) NOPASSWD: /sbin/nfsd\n%staff ALL=(ALL) NOPASSWD: /bin/cp /etc/nfs.conf /etc/nfs.conf.bak\n%staff ALL=(ALL) NOPASSWD: /usr/bin/tee /etc/exports\n%staff ALL=(ALL) NOPASSWD: /usr/bin/tee /etc/nfs.conf\n%staff ALL=(ALL) NOPASSWD: $(brew --prefix)/opt/docker-virtualbox/bin/gobetween\nSUDOERS\n```\n\n> Reboot to apply changes.\n\n---\n\n## 5. Configure Environment\n\nIf **not** using Docker Desktop:\n\n```\nbrew link --force --overwrite docker-virtualbox\n```\n\nIf **using** Docker Desktop:\n\n**bash**\n\n```\necho \"export PATH=\\\"$(brew --prefix docker-virtualbox)/bin:$PATH\\\"\" >> ~/.bash_profile\n```\n\n**zsh**\n\n```\necho \"export PATH=\\\"$(brew --prefix docker-virtualbox)/bin:$PATH\\\"\" >> ~/.zshrc\n```\n\nReload:\n\n```\nexec $SHELL\n```\n\n---\n\n## 6. Initialize Docker Machine\n\nRun once:\n\n```\ndocker-machine-init initialize\n```\n\nThis will download, prepare, and configure the VirtualBox Docker Machine.\n\n---\n\n## 7. Start docker‑virtualbox\n\n```\nbrew services start docker-virtualbox\n```\n\nLogs:\n\n```\n/tmp/docker-virtualbox.log\n```\n\n---\n\n## 8. Test Docker\n\n```\ndocker run -d -p 8989:80 nginx\ncurl -v localhost:8989\n```\n\n---\n\n# Additional Options\n\n## Use a Non‑VirtualBox Driver\n\nExample (generic SSH driver):\n\n```\ndocker-machine create \\\n  --driver generic \\\n  --generic-ip-address=192.168.24.108 \\\n  --generic-ssh-user=developer \\\n  --generic-ssh-key=$HOME/.ssh/id_rsa \\\n  docker\n```\n\n> Works only with Debian‑based remote systems.\n\n---\n\n## Useful Commands\n\nView logs:\n\n```\ntail -n 1000 -f /tmp/docker-virtualbox.log\n```\n\nSSH into the machine:\n\n```\ndocker-machine ssh docker\n```\n\nStop service:\n\n```\nbrew services stop docker-virtualbox\n```\n\nLoad environment for tools:\n\n```\nsource /tmp/docker-virtualbox.env\nsource /tmp/docker-virtualbox-machine.env\n```\n\n---\n\n# Optional Enhancements\n\n## Auto‑Start on Login\n\nCreate launch agents:\n\n```\nmkdir -p ~/Library/LaunchAgents\n```\n\nConfigure a custom plist to auto‑start docker‑virtualbox.\n\n## Increase VM Resources\n\n```\ndocker-machine stop docker\nVBoxManage modifyvm docker --memory 4096 --cpus 4\ndocker-machine start docker\n```\n\n## Custom Network Range\n\nEdit:\n\n```\nsudo nano /etc/vbox/networks.conf\n```\n\nAdd:\n\n```\n* 10.10.0.0/16\n```\n\n---\n\n# Known Issues\n\n1. macOS cannot sleep while NFS is running.\n2. UDP port forwarding not supported.\n3. VirtualBox may need kext reload after macOS updates.\n4. File sharing may be slower compared to Docker Desktop.\n"
  },
  {
    "path": "bin/docker",
    "content": "#!/usr/bin/env bash\nset -e\n#set -x\nLIMIT=90\nif [[ -f /tmp/docker-virtualbox.starting ]]; then\n    >&2 echo -e \"\\033[93mWaiting while Docker starting...\"\n    >&2 echo -e \"\\033[0m\"\n    i=0\n    while [[ -f /tmp/docker-virtualbox.starting ]]; do\n        if [[ \"$i\" -gt \"$LIMIT\" ]]; then\n            >&2 echo -e \"Default \\e[91mThe timeout reached, please verify the vm log for errors: /tmp/docker-virtualbox.log\\e[39m\"\n        fi\n        i=$(($i+1))\n        sleep 1;\n    done\nfi\n\n[[ -f /tmp/docker-virtualbox.env && -f /tmp/docker-virtualbox-machine.env ]] || {\n    echo -e \"\\033[91m\"\n    echo -e \"\\033[91mLooks like docker-virtualbox doesn't work\"\n    echo -e \"\"\n    echo -e \"\\033[0mYou have to start it by following command:\"\n    echo -e \"\"\n    echo -e \"\\033[96mbrew services start docker-virtualbox \"\n    echo -e \"\\033[0m\"\n    exit 1\n}\n\nsource /tmp/docker-virtualbox.env\n\n[[ -z \"${DOCKER_HOST}\" ]] && { \n    source /tmp/docker-virtualbox-machine.env\n}\n\nexec ${DOCKER_CLI_BIN_PATH} \"$@\"\n"
  },
  {
    "path": "bin/docker-compose",
    "content": "#!/usr/bin/env bash\nset -e\n#set -x\nLIMIT=90\nif [[ -f /tmp/docker-virtualbox.starting ]]; then\n    >&2 echo -e \"\\033[93mWaiting while Docker starting...\"\n    >&2 echo -e \"\\033[0m\"\n    i=0\n    while [[ -f /tmp/docker-virtualbox.starting ]]; do\n        if [[ \"$i\" -gt \"$LIMIT\" ]]; then\n            >&2 echo -e \"Default \\e[91mThe timeout reached, please verify the vm log for errors: /tmp/docker-virtualbox.log\\e[39m\"\n        fi\n        i=$(($i+1))\n        sleep 1;\n    done\nfi\n\n[[ -f /tmp/docker-virtualbox.env && -f /tmp/docker-virtualbox-machine.env ]] || {\n    echo -e \"\\033[91m\"\n    echo -e \"\\033[91mLooks like docker-virtualbox doesn't work\"\n    echo -e \"\"\n    echo -e \"\\033[0mYou have to start it by following command:\"\n    echo -e \"\"\n    echo -e \"\\033[96mbrew services start docker-virtualbox \"\n    echo -e \"\\033[0m\"\n    exit 1\n}\n\nsource /tmp/docker-virtualbox.env\n\n[[ -z \"${DOCKER_HOST}\" ]] && { \n    source /tmp/docker-virtualbox-machine.env\n}\n\nexec ${DOCKER_COMPOSE_BIN_PATH} \"$@\"\n"
  },
  {
    "path": "bin/docker-machine-init",
    "content": "#!/usr/bin/env bash\nset -e\n[[ $1 == \"debug\" ]] && {\n  set -x\n}\nif [[ $(id -u ${USER}) -eq 0 ]]; then\n  echo \"Please don't run this script under the root user!\"\n  exit 1\nfi\nLOGDIR=\"/tmp\";\n\n[[ $1 != \"initialize\" ]] && [[ $1 != \"debug\" ]] && {\n    exec > ${LOGDIR}/docker-virtualbox.log\n    exec 2>&1\n}\n\nSTART_TIME=$(date +%s)\n\nif [[ -n \"${BREW_BIN}\" ]]; then\n    BREW_BIN=$BREW_BIN\nelif [[ \"Darwin\" == \"$(uname)\" ]]; then\n    BREW_BIN=/usr/local/bin\nelse\n    BREW_BIN=/home/linuxbrew/.linuxbrew/bin\nfi\n\nPATH=\"${PATH}:${BREW_BIN}\"\nGOBETWEEN_BIN=$(brew --prefix)/opt/docker-virtualbox/bin/gobetween\nTERMINAL_NOTIFIER_BIN=\"$(brew --prefix terminal-notifier)/bin/terminal-notifier -appIcon $(brew --prefix docker-virtualbox)/djocker.png\"\nJQ_BIN=\"$(brew --prefix jq)/bin/jq\"\nDOCKER_MACHINE_BIN=$(brew --prefix docker-machine)/bin/docker-machine\nDOCKER_MACHINE_NFS_BIN=$(brew --prefix docker-machine-nfs-generic)/bin/docker-machine-nfs-generic\n\nDOCKER_MACHINE_DRIVER=${DOCKER_DRIVER-virtualbox}\nDOCKER_MACHINE_MACHINE_NAME=${DOCKER_MACHINE_NAME-docker}\n\nfunction stop()\n{\n    [[ -f /tmp/docker-virtualbox.env ]] && rm /tmp/docker-virtualbox.env\n    [[ -f /tmp/docker-virtualbox-machine.env ]] && rm /tmp/docker-virtualbox-machine.env\n    echo \"===> Stopping docker machine: ${DOCKER_MACHINE_MACHINE_NAME}\"\n    ${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Stopping virtual machine: '${DOCKER_MACHINE_MACHINE_NAME}'\"\n    ${DOCKER_MACHINE_BIN} stop ${DOCKER_MACHINE_MACHINE_NAME}\n    exit 0\n}\n\ntrap stop SIGKILL\ntrap stop SIGTERM\ntrap stop SIGINT\n\n\n${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Initialize...\"\nsleep 1\n\nif [[ -z ${DOCKER_MACHINE_DISK_SIZE} ]]; then\n    DOCKER_MACHINE_DISK_SIZE=\"16000\"\n    if [[ $($(brew --prefix coreutils)/libexec/gnubin/df --block-size=1073741824 | grep '\\/$' | awk '{print $2}') -gt 200 ]]; then\n        DOCKER_MACHINE_DISK_SIZE=\"32000\"\n    fi\nfi\n\nif [[ -z ${DOCKER_MACHINE_CPU_COUNT} ]]; then\n    if [[ \"Darwin\" == \"$(uname)\" ]]; then\n        DOCKER_MACHINE_CPU_COUNT=$(sysctl -n hw.ncpu | awk 'function ceil(x, y){y=int(x); return(x>y?y+1:y)} { print ceil($1*0.25) }')\n    else\n        DOCKER_MACHINE_CPU_COUNT=$(grep ^cpu\\\\scores /proc/cpuinfo | uniq |  awk '{print $4}' | awk 'function ceil(x, y){y=int(x); return(x>y?y+1:y)} { print ceil($1*0.25) }')\n    fi\nfi\n\nif [[ -z ${DOCKER_MACHINE_MEMORY_COUNT} ]]; then\n    if [[ \"Darwin\" == \"$(uname)\" ]]; then\n        DOCKER_MACHINE_MEMORY_COUNT=$(sysctl -n hw.memsize | awk '{ mem=($1 * 0.25 / 1024 / 1024 ); print int(mem > 4096 ? 4096 : mem) }')\n    else\n        DOCKER_MACHINE_MEMORY_COUNT=$(free -b | grep Mem | awk '{ mem=($2 * 0.25 / 1024 / 1024 ); print int(mem > 4096 ? 4096 : mem) }')\n    fi\nfi\n\n[[ \"Running\" == $(${DOCKER_MACHINE_BIN} status ${DOCKER_MACHINE_MACHINE_NAME}) ]] && {\ntouch /tmp/docker-virtualbox.starting\necho \"===> Virtual machine '${DOCKER_MACHINE_MACHINE_NAME}' already started\"\n${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Virtual machine '${DOCKER_MACHINE_MACHINE_NAME}' started\"\n} || {\n    touch /tmp/docker-virtualbox.starting\n    [[ \"Stopped\" == $(${DOCKER_MACHINE_BIN} status ${DOCKER_MACHINE_MACHINE_NAME}) ]] && {\n        ${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Starting virtual machine: ${DOCKER_MACHINE_MACHINE_NAME}\"\n        echo \"===> Starting docker machine: ${DOCKER_MACHINE_MACHINE_NAME}\"\n        ${DOCKER_MACHINE_BIN} start ${DOCKER_MACHINE_MACHINE_NAME}\n    } || {\n        echo \"===> Creating docker machine: ${DOCKER_MACHINE_MACHINE_NAME}\"\n        ${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Creating virtual machine: ${DOCKER_MACHINE_MACHINE_NAME}\"\n        ${DOCKER_MACHINE_BIN} create --driver ${DOCKER_MACHINE_DRIVER} \\\n            --virtualbox-cpu-count ${DOCKER_MACHINE_CPU_COUNT} \\\n            --virtualbox-memory ${DOCKER_MACHINE_MEMORY_COUNT} \\\n            --virtualbox-disk-size ${DOCKER_MACHINE_DISK_SIZE} \\\n            ${DOCKER_MACHINE_MACHINE_NAME}\n    }\n\n    # Extra vm options\n    ${DOCKER_MACHINE_BIN} ssh ${DOCKER_MACHINE_MACHINE_NAME} sudo sysctl -w vm.max_map_count=262144\n}\n\n${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Configuring NFS mount for: '${DOCKER_MACHINE_MACHINE_NAME}'\"\n\n${DOCKER_MACHINE_NFS_BIN} ${DOCKER_MACHINE_MACHINE_NAME}\n\n[[ $1 == \"initialize\" ]] && {\n    echo \"\"\n    echo -e \"\\033[91m>>>>> \\033[92m *** CONGRATULATION *** DOCKER READY TO USE *** \\033[91m<<<<<\"\n    echo -e \"\\033[0m\"\n    echo \"Please start the service by following command:\"\n    echo -e \"\\033[0m\"\n    echo -e \"\\033[0m\"\n    echo -e \"    \\033[96mbrew services start docker-virtualbox\"\n    echo -e \"\\033[0m\"\n    exit 0\n}\n\necho \"===> Starting Gobetween...\"\n[[ -f /tmp/docker-virtualbox-gobetween.pid ]] && ps -p $(cat /tmp/docker-virtualbox-gobetween.pid) > /dev/null && {\n    echo \"---> Gobetween already started, disabling outdated port forwarding...\"\n    servers=$(curl --silent http://127.0.0.1:8181/servers | ${JQ_BIN} -r '. | keys | .[]')\n    for server in $servers;  do\n        echo \"Disabling port forwarding for: ${server}\"\n        curl --silent -X DELETE http://127.0.0.1:8181/servers/${server}\n    done\n} || {\n    sudo ${GOBETWEEN_BIN} -c $(brew --prefix)/etc/docker-virtualbox/gobetween.toml > ${LOGDIR}/docker-virtualbox-gobetween.log 2>&1 &\n    echo $! > /tmp/docker-virtualbox-gobetween.pid\n    echo \"---> Gobetween started\"\n}\n\n# setup env\necho \"export DOCKER_CLI_BIN_PATH=\\\"$(brew --prefix docker)/bin/docker\\\"\" > /tmp/docker-virtualbox.env\necho \"export DOCKER_COMPOSE_BIN_PATH=\\\"$(brew --prefix docker-compose)/bin/docker-compose\\\"\" >> /tmp/docker-virtualbox.env\necho \"export DOCKER_MACHINE_IP=\\\"$(${DOCKER_MACHINE_BIN} ip ${DOCKER_MACHINE_MACHINE_NAME})\\\"\" >> /tmp/docker-virtualbox.env\n${DOCKER_MACHINE_BIN} env ${DOCKER_MACHINE_MACHINE_NAME} --shell bash >> /tmp/docker-virtualbox-machine.env\n${TERMINAL_NOTIFIER_BIN} -title \"Docker Virtualbox\" -message \"Virtual machine '${DOCKER_MACHINE_MACHINE_NAME}' ready for work\"\n\n\nsource /tmp/docker-virtualbox.env\nsource /tmp/docker-virtualbox-machine.env\n\necho \"\"\necho \"===> Configuring port forwarding for alrady running containers...\"\nwhile read -r subjectid\ndo\n    ports=\"$(${DOCKER_CLI_BIN_PATH} inspect -f '{{range $p, $conf := .NetworkSettings.Ports }} {{ if $conf}} {{$conf}} {{end}} {{end}}' \"${subjectid}\" | sed -nE 's:\\[\\{[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}[^0-9]*([0-9]{1,})\\}\\]:\\1:pg' | xargs echo -n)\"\n    [[ -z ${ports} ]] || {\n        for port in $ports;  do\n          echo \"\"\n          echo \"Enabling port forwarding: ${port} -> ${DOCKER_MACHINE_IP}:${port}\"\n          >&2 curl --silent -X POST --data \"@-\" http://127.0.0.1:8181/servers/${subjectid_short}_${port} <<JSON_BODY\n{\n  \"backend_connection_timeout\": \"2s\",\n  \"backend_idle_timeout\": \"1m\",\n  \"balance\": \"weight\",\n  \"bind\": \":${port}\",\n  \"client_idle_timeout\": \"1m\",\n  \"max_connections\": 10000,\n  \"protocol\": \"tcp\",\n  \"discovery\": {\n    \"kind\": \"static\",\n    \"static_list\": [\n      \"${DOCKER_MACHINE_IP}:${port} weight=1\"\n    ]\n  }\n}\nJSON_BODY\n        done\n    }\ndone < <(${DOCKER_CLI_BIN_PATH} ps | tail -n +2 | awk '{ print $1 }')\n\necho \"\"\necho \"===> Listen for events...\"\n[[ -f /tmp/docker-virtualbox.starting ]] && rm /tmp/docker-virtualbox.starting\nwhile read -r event;\ndo\n    subject=$(echo $event | awk '{ print $2 }')\n    action=$(echo $event | awk '{ print $3 }')\n    subjectid=$(echo $event | awk '{ print $4 }')\n    subjectid_short=$(echo $subjectid | cut -c -8)\n    if [[ \"container\" == ${subject} ]]; then\n        case $action in\n          \"start\")\n            ports=\"$(${DOCKER_CLI_BIN_PATH} inspect -f '{{range $p, $conf := .NetworkSettings.Ports }} {{ if $conf}} {{$conf}} {{end}} {{end}}' \"${subjectid}\" | sed -nE 's:\\[\\{[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}[^0-9]*([0-9]{1,})\\}\\]:\\1:pg' | xargs echo -n)\"\n            [[ -z ${ports} ]] || {\n                for port in $ports;  do\n                    echo \"\"\n                    echo \"Enabling port forwarding: ${port} -> ${DOCKER_MACHINE_IP}:${port}\"\n                    >&2 curl --silent -X POST --data \"@-\" http://127.0.0.1:8181/servers/${subjectid_short}_${port} <<JSON_BODY\n{\n  \"backend_connection_timeout\": \"2s\",\n  \"backend_idle_timeout\": \"1m\",\n  \"balance\": \"weight\",\n  \"bind\": \":${port}\",\n  \"client_idle_timeout\": \"1m\",\n  \"max_connections\": 10000,\n  \"protocol\": \"tcp\",\n  \"discovery\": {\n    \"kind\": \"static\",\n    \"static_list\": [\n      \"${DOCKER_MACHINE_IP}:${port} weight=1\"\n    ]\n  }\n}\nJSON_BODY\n                done\n            }\n            ;;\n          \"kill\")\n            servers=$(curl --silent http://127.0.0.1:8181/servers | ${JQ_BIN} -r '. | keys | .[]' | grep ${subjectid_short} || echo \"\")\n            [[ $servers != \"\" ]] && {\n              for server in $servers;  do\n                  echo \"\"\n                  echo \"Disabling port forwarding for: ${server}\"\n                  curl --silent -X DELETE http://127.0.0.1:8181/servers/${server}\n              done\n            }\n            ;;\n          *)\n            # skipping\n            ;;\n        esac\n    fi\ndone < <(${DOCKER_CLI_BIN_PATH} events --since \"${START_TIME}\")\n\necho \"\"\necho \"===> service terminated\"\n"
  }
]