vmorganp / Lazytainer

Docker container lazy loading
MIT License
574 stars 20 forks source link

How do you use this with separate compose files / example for that use case #69

Closed OWL4C closed 2 months ago

OWL4C commented 2 months ago

I have successfully run the whoami example, and wanted to try this with other containers. I have the lazytainer compose file, which only has the service definition for lazytainer

services:
  lazytainer:
    container_name: lazytainer
    image: ghcr.io/vmorganp/lazytainer:master
    environment:
      - VERBOSE=true
    ports:
      - "8000:8000"
      - "6379:6379"
      - "3000:3000"
      - "9998:9998"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "lazytrainer.group.paperless.ports=8000,6379,3000,9998"
      - "lazytrainer.group.paperless.inactiveTimeout=15"
      - "lazytrainer.group.paperless.minPacketThreshold=1"
      - "lazytrainer.group.paperless.sleepMethod=pause"

and a compose file for paperless-ngx. (Too big to paste here, the following will be only the modifications i made to allow lazytrainer to access this.)

services:
  broker: #paperless uses 4 different services, i will only show this as representative for the others, and the main one
        labels:
          - "lazytrainer.group=paperless"
  webserver:
    labels:
      - "lazytrainer.group=paperless"
    network_mode: container:lazytainer

networks: #i added this so that all the containers within both compose files use the same network and can communicate, as is needed by paperless
  default:
    name: lazytrainer_default
    external: true

However, starting any combination of these files does not result in any output from lazy, nor does it seem to shut down the service.I cannot connect to 8000, but the port is opened on the host. Lazy seems to have opened the defined ports, but doesn't send the traffic through. The log files from paperless indicate that the container can interact with each other, i.e. the broker service is reachable from the webserver.

Edit: Even with Lazytrainer inside the compose file, having nothing else changed, while i can access the service at port 8000, meaning lazytrainer must be online, there is no log output, no shutdown, nothing.

OWL4C commented 2 months ago

Adding the poll rate label now makes it panic and crash the entire compose.

lazytainer   | panic: strconv.Atoi: parsing "": invalid syntax
lazytainer   |
lazytainer   | goroutine 1 [running]:
lazytainer   | main.check(...)
lazytainer   |  github.com/lazytainer/lazytainer.go:191
lazytainer   | main.configureFromLabels()
lazytainer   |  github.com/lazytainer/lazytainer.go:99 +0x1247
lazytainer   | main.main()
lazytainer   |  github.com/lazytainer/lazytainer.go:51 +0x185
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to create new parent process: namespace path: lstat /proc/53395/ns/net: no such file or directory: unknown
OWL4C commented 2 months ago

Nevermind, i just had a typo in one of my files, and not the other