fmartinou / whats-up-docker

What's up Docker ( aka WUD ) gets you notified when a new version of your Docker Container is available.
https://fmartinou.github.io/whats-up-docker
MIT License
1.02k stars 33 forks source link

Error when creating container grafana ((HTTP code 400) unexpected - Container cannot be connected to network endpoints: dlbox_private, backend_private ) (container=local_grafana) #169

Open r0m1CH opened 1 year ago

r0m1CH commented 1 year ago

Hello,

I encounter a new issue with automatic updates through my docker-compose file. I have a grafana container which needs to be updated. WUD sees the update, download it, stop my container and try to recreate the new one.

However it will never get back online. Here the log, I have: _Error when creating container grafana ((HTTP code 400) unexpected - Container cannot be connected to network endpoints: dlbox_private, backend_private ) (container=localgrafana)

Anything am I doing wrong here or any configuration i'm missing ?

Thanks for your help.

r0m1CH commented 1 year ago

Anything ? i do see that docker does not accept to be connect to both network directly at the beginning. It seems that docker needs to connect the container to only one network at the start, then disconnect from it and finally connect, to both networks. Does that make sense for you ?

Teleportist commented 1 year ago

Could this be anything to do with Grafana using the same port as What's Up Docker for it's webui? If so, maybe port mapping WUD to another port on the host (eg. 3333:3000) would fix it?

r0m1CH commented 1 year ago

I can try but the error seems to be specific to the multiple network instead no? I have this issue with all my container that use 2 or more networks. I find a similar case on Watchtower's project and seems to solved it the way i describe it into the second post: It seems that docker needs to connect the container to only one network at the start, then disconnect from it and finally connect, to both networks.

fmartinou commented 1 year ago

Hi,

Can you provide your docker-compose file, please (so that I can make some tests on my end)?

r0m1CH commented 1 year ago

Hi,

Here you go : https://pastebin.com/5HAchU0T This is teslamate project. In this example, my PostgreSQL database is only available in an isolated backend network when the rest is on the LAN. Let me know if you need more info.

Zatow commented 1 year ago

Hi,

I have a same issue with all container using 2 networks : Error when creating container APPS_Uptime-Kuma ((HTTP code 400) unexpected - Container cannot be connected to network endpoints: APPS, TRAEFIK ) (container=local_APPS_Uptime-Kuma)

When I comment out the APPS or TRAEFIK network of my APPS_Uptime-Kuma container, I don't get an error.

My compose :

version: '3.9'

services:
  APPS_Uptime-Kuma:
    container_name: APPS_Uptime-Kuma
    image: louislam/uptime-kuma:1.20.1
    restart: unless-stopped
    ports:
      - 3001:3001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro  # Pour que uptime-kuma puisse écouter les événements Docker
      - ./${SERVICE_UPTIME_KUMA}/data:/app/data
    environment:
      - TZ=${TZ}
    networks:
      - TRAEFIK
      - APPS
    labels:
      - wud.watch=true
      - wud.watch.digest=false
      - wud.tag.include=^\d+\.\d+\.\d+$$
  APPS_WUD:
    image: fmartinou/whats-up-docker:6.0.2
    container_name: APPS_WUD
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./docker-compose.yaml:/wud/docker-compose.yaml
    ports:
      - 3000:3000
    networks:
      - TRAEFIK
      - APPS
    restart: unless-stopped
    environment:
      - WUD_WATCHER_LOCAL_CRON=0 * * * *
      - WUD_WATCHER_LOCAL_WATCHBYDEFAULT=false
      - WUD_REGISTRY_HUB_LOGIN=login
      - WUD_REGISTRY_HUB_PASSWORD=password
      - WUD_TRIGGER_DOCKERCOMPOSE_APPS_MODE=batch
      - WUD_TRIGGER_DOCKERCOMPOSE_APPS_FILE=/wud/docker-compose.yaml
      - WUD_TRIGGER_DOCKERCOMPOSE_APPS_BACKUP=false
      - WUD_TRIGGER_DOCKERCOMPOSE_APPS_PRUNE=false
    labels:
    #### WUD ####
      - wud.watch=true
      - wud.watch.digest=false
      - wud.tag.include=^\d+\.\d+\.\d+$$
networks:
  TRAEFIK:
    external: true
  APPS:
    external: true
strayer commented 1 year ago

Watchtower seems to have had the same issue a while ago: https://github.com/containrrr/watchtower/pull/40

Related: https://github.com/moby/moby/issues/29265

This is expected, when creating a container, you can only specify a single network. Subsequent networks can be attached after that (docker network attach, or the corresponding API call docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/connect-a-container-to-a-network)

appiekap653 commented 11 months ago

any news on this, still having this issue for all my containers that have multiple networks connected. when not fixed it will make this app unusable for a lot of people. that would be a shame because it is really a great app. thanks for creating it. I'm using the docker-compose trigger, why not use the original docker-compose up -d command? That will fix this issue when using the docker-compose trigger.

SMHRambo commented 10 months ago

I have the same problem. All my containers use netvlans and docker internal networks for databases. Any workarounds to solve this problem?

appiekap653 commented 3 months ago

Could we please get a fix for this so I can start using this software again, it is still unusable at the moment.

appiekap653 commented 2 months ago

Any news regarding this issue? will this get picked up or not?

appiekap653 commented 2 months ago

@fmartinou would you please look at this issue? maybe integrate this package: dockerode-compose, instead of dockerode for the compose watcher? I believe there is support in that package for containers with multiple networks. only thing I don't know is if this will work for all the rest, since this package is a complete rewrite of compose I don't know if it works correct for the complete compose specification.