Giter Club home page Giter Club logo

Comments (7)

zhorvath83 avatar zhorvath83 commented on August 12, 2024 1

@thewinger In case you do not directly mount the docker.sock into the autoheal container you should provide an alternative method to reach the docker socket. If the alternative method is a socket proxy (via TCP connection) you should set the address of it in the DOCKER_SOCK environment variable. You added the socket_proxy network to the autoheal container on which the socket proxy container is located, this is good. So "you have to instruct" autoheal to use a TCP connection instead of direct docker socket access.

from docker-autoheal.

zhorvath83 avatar zhorvath83 commented on August 12, 2024

I tried to pair willfarrell/autoheal with tprasadtp/docker-socket-proxy, but found the same issue.

autoheal: 
    image: willfarrell/autoheal:latest
    container_name: autoheal
    depends_on:
      - socketproxy
    networks:
      - socketproxynet
    environment:
      DOCKER_SOCK: tcp://socketproxy:2375
      AUTOHEAL_INTERVAL: 5
      AUTOHEAL_START_PERIOD: 0
      AUTOHEAL_DEFAULT_STOP_TIMEOUT: 30
    labels:
      diun.enable: "true"
    restart: unless-stopped

2020-12-07T07:36:27.214593318Z /docker-entrypoint: exec: line 101: autoheal: not found

Other containers (Watchtower, Diun, Portainer) works well with this companion.

@thewinger Have you added the DOCKER_SOCK environment variable instead of mounting the docker sock directly to your autoheal container?

from docker-autoheal.

thewinger avatar thewinger commented on August 12, 2024

@zhorvath83 have not tried to. I just wen with the default and used the

volume:
 - /var/run/docker.sock:/var/run/docker.sock

from docker-autoheal.

thewinger avatar thewinger commented on August 12, 2024

I don't really have the knowledge to follow you up.
I tried adding

DOCKER_SOCK: tcp//socket-proxy:2375

but did not work.

from docker-autoheal.

zhorvath83 avatar zhorvath83 commented on August 12, 2024

@thewinger A colon is missing, otherwise everything is fine with it. It should look like this in your case:

In the autoheal docker container's compose you should include this:

    environment:
      DOCKER_SOCK: tcp://socket-proxy:2375

The next step is to configure the endpoint access rights on the socket proxy. For a test only, I allowed access to ALL endpoints (value 1) but it didn't worked. Ultimately, I am struggling with the same problem as you: autoheal doesen't starts in companion of socket proxy.

  socketproxy:
    container_name: socketproxy
    image: ghcr.io/tprasadtp/docker-socket-proxy
    networks:
      - socketproxynet
    privileged: true
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - LOG_LEVEL=debug
      - EVENTS=1
      - PING=1
      - VERSION=1
      - AUTH=1
      - SECRETS=1
      - POST=1
      - DELETE=1
      - BUILD=1
      - COMMIT=1
      - CONFIGS=1
      - CONTAINERS=1
      - DISTRIBUTION=1
      - EXEC=1
      - IMAGES=1
      - INFO=1
      - NETWORKS=1
      - NODES=1
      - PLUGINS=1
      - SERVICES=1
      - SESSION=1
      - SWARM=1
      - SYSTEM=1
      - TASKS=1
      - VOLUMES=1
      - CONTAINERS_CREATE=1
      - CONTAINERS_START=1
      - CONTAINERS_UPDATE=1
      - CONTAINERS_DELETE=1
      - IMAGES_DELETE=1
    labels:
      diun.enable: "true"
    restart: unless-stopped

Other containers (Watchtower, Diun, Portainer) works well with this companion.

from docker-autoheal.

kikearciniegas avatar kikearciniegas commented on August 12, 2024

Same issue here, is there a fix for this?

from docker-autoheal.

nukedupe avatar nukedupe commented on August 12, 2024

Here is a fix in two patches.
First patch add tcp support without ssl. Use tcp:// or tcps:// with DOCKER_SOCK.
Second patch fixes "not found" problem.

@ -10,7 +10,9 @@

 # only use unix domain socket if no TCP endpoint is defined
 case "${DOCKER_SOCK}" in
-  "tcp://"*) HTTP_ENDPOINT="$(echo ${DOCKER_SOCK} | sed 's#tcp://#https://#')"
+  "tcp://"*) HTTP_ENDPOINT="$(echo ${DOCKER_SOCK} | sed 's#tcp://#http://#')"
+             ;;
+  "tcps://"*) HTTP_ENDPOINT="$(echo ${DOCKER_SOCK} | sed 's#tcps://#https://#')"
              CA="--cacert /certs/ca.pem"
              CLIENT_KEY="--key /certs/client-key.pem"
              CLIENT_CERT="--cert /certs/client-cert.pem"
@ -64,7 +66,13 @@
 # shellcheck disable=2039
 trap 'kill $$; term_handler' SIGTERM

-if [ "$1" = "autoheal" ] && [ -e "$DOCKER_SOCK" ];then
+if [ "$1" = "autoheal" ]
+then
+  if [ -n "$UNIX_SOCK" ] && ! [ -S "$DOCKER_SOCK" ]
+  then
+    echo "Connection problem"
+    exit
+  fi
   # Delayed startup
   if [ "$AUTOHEAL_START_PERIOD" -gt 0 ]
   then

from docker-autoheal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.