docker-tc icon indicating copy to clipboard operation
docker-tc copied to clipboard

not working in docker compose mode

Open Eucliddd opened this issue 3 years ago • 1 comments

My container is created by docker compose up -d, and i have add labels into docker-compose.yml as follows:

version: "2.3"
services:
  emby:
    image: lovechen/embyserver:latest
    container_name: emby
    network_mode: host
    environment:
      - UID=1000 # The UID to run emby as (default: 2)
      - GID=1000 # The GID to run emby as (default 2)
      - GIDLIST=1000 # A comma-separated list of additional GIDs to run emby as (default: 2)
    volumes:
      - /root/docker/emby/config:/config
      - /root/media/rclone/myAlist:/movie
    deploy:
      labels:
        com.docker-tc.enabled: 1
        com.docker-tc.limit: 100mbps
    restart: unless-stopped

The container id is 356c6968c23e. However, it does not work, and the log is as follows:

2022/12/13 09:29:32 Thanks for using hapttic v1.0.0
2022/12/13 09:29:32 Listening on 127.0.0.1:4080
2022/12/13 09:29:32 Forwarding requests to /docker-tc/bin/httpd.sh
2022/12/13 09:29:32 Logging errors to stderr
[2022-12-13T09:29:33+00:00] [07aa0054ceab] Notice: Skipping container, no valid labels found
[2022-12-13T09:29:33+00:00] [18758b8daca1] Notice: Skipping container, service was disabled by label
[2022-12-13T09:29:34+00:00] [9f60ccdfcf86] Notice: Skipping container, no valid labels found
[2022-12-13T09:29:34+00:00] [a7981804c7ad] Notice: Skipping container, no valid labels found
[2022-12-13T09:30:29+00:00] [85be2c3272d4] Notice: Skipping container, no valid labels found
[2022-12-13T09:30:38+00:00] [1f9db4f5eb18] Notice: Skipping container, no valid labels found
[2022-12-13T09:30:43+00:00] [f6ae6c0fe610] Notice: Skipping container, no valid labels found
[2022-12-13T09:42:55+00:00] [6a3a1e5a96fe] Notice: Skipping container, no valid labels found
2022/12/13 09:45:25 Executing /docker-tc/bin/httpd.sh
2022/12/13 09:45:40 Executing /docker-tc/bin/httpd.sh
[2022-12-13T09:56:42+00:00] [356c6968c23e] Notice: Skipping container, no valid labels found

Eucliddd avatar Dec 13 '22 11:12 Eucliddd

In my case, writing labels under the main block (and not under deploy) works fine:

version: "2.3"
services:
  emby:
    image: lovechen/embyserver:latest
    container_name: emby
    network_mode: host
    environment:
      - UID=1000 # The UID to run emby as (default: 2)
      - GID=1000 # The GID to run emby as (default 2)
      - GIDLIST=1000 # A comma-separated list of additional GIDs to run emby as (default: 2)
    volumes:
      - /root/docker/emby/config:/config
      - /root/media/rclone/myAlist:/movie
    labels:
      - "com.docker-tc.enabled=1"
      - "com.docker-tc.limit=100mbps"
        
    restart: unless-stopped

This should gives you the logs you want. But still no effect on download or upload bandwidth.

mohrezaee avatar Dec 17 '22 13:12 mohrezaee