{"action":"created","issue":{"url":"https://api.github.com/repos/firehol/netdata/issues/3972","repository_url":"https://api.github.com/repos/firehol/netdata","labels_url":"https://api.github.com/repos/firehol/netdata/issues/3972/labels{/name}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/3972/comments","events_url":"https://api.github.com/repos/firehol/netdata/issues/3972/events","html_url":"https://github.com/firehol/netdata/issues/3972","id":341668362,"node_id":"MDU6SXNzdWUzNDE2NjgzNjI=","number":3972,"title":"docker container names not resolved when using firehol/netdata:alpine","user":{"login":"pgassmann","id":460192,"node_id":"MDQ6VXNlcjQ2MDE5Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/460192?v=4","gravatar_id":"","url":"https://api.github.com/users/pgassmann","html_url":"https://github.com/pgassmann","followers_url":"https://api.github.com/users/pgassmann/followers","following_url":"https://api.github.com/users/pgassmann/following{/other_user}","gists_url":"https://api.github.com/users/pgassmann/gists{/gist_id}","starred_url":"https://api.github.com/users/pgassmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgassmann/subscriptions","organizations_url":"https://api.github.com/users/pgassmann/orgs","repos_url":"https://api.github.com/users/pgassmann/repos","events_url":"https://api.github.com/users/pgassmann/events{/privacy}","received_events_url":"https://api.github.com/users/pgassmann/received_events","type":"User","site_admin":false},"labels":[{"id":350638115,"node_id":"MDU6TGFiZWwzNTA2MzgxMTU=","url":"https://api.github.com/repos/firehol/netdata/labels/installation%20issue","name":"installation issue","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":40,"created_at":"2018-07-16T20:32:18Z","updated_at":"2018-07-23T18:18:19Z","closed_at":null,"author_association":"NONE","body":"when running netdata in docker with /var/run/docker.sock mounted to container, the names of cgroups are not resolved when using image `firehol/netdata:alpine` but it works with `firehol/netdata:latest`\r\n\r\nAlso reported to: https://github.com/titpetric/netdata/issues/70\r\n\r\nThe actual issue is that in the alpine image, the `netdata` user is not in the `docker` group.\r\n\r\nimage: titpetric/netdata:latest\r\nor \r\nimage: firehol/netdata\r\n=> container names OK\r\n\r\n```\r\n# ps aufx\r\nUSER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\r\nroot       607  0.0  0.1  18188  2928 pts/0    Ss   18:59   0:00 /bin/bash\r\nroot      1814  0.0  0.1  36640  2828 pts/0    R+   19:01   0:00  \\_ ps aufx\r\nnetdata      1  1.2  2.0 185452 41676 ?        Ssl  18:58   0:02 /usr/sbin/netdata -D -s /host -p 19999\r\nnetdata     18  0.3  0.1  18164  2244 ?        S    18:58   0:00 bash /usr/libexec/netdata/plugins.d/tc-qos-helper.sh 1\r\nroot        29  1.7  0.1  19540  2636 ?        S    18:58   0:02 /usr/libexec/netdata/plugins.d/apps.plugin 1\r\n\r\n# ls -lha /var/run/docker.sock \r\nsrw-rw---- 1 root netdata 0 Jun 17 14:45 /var/run/docker.sock\r\n\r\n# id netdata\r\nuid=999(netdata) gid=999(netdata) groups=999(netdata),4(adm),13(proxy)\r\n```\r\n\r\nimage: firehol/netdata:alpine\r\n-> container names MISSING\r\n\r\n```\r\n# ps aufx\r\nPID   USER     TIME  COMMAND\r\n    1 netdata   0:01 /usr/sbin/netdata -D -s /host -p 19999\r\n   26 root      0:01 /usr/libexec/netdata/plugins.d/apps.plugin 1\r\n  534 root      0:00 /bin/bash\r\n  540 root      0:00 ps aufx\r\n# ls -lha /var/run/docker.sock\r\nsrw-rw----    1 root     ping           0 Jun 17 14:45 /var/run/docker.sock\r\n\r\n# id netdata\r\nuid=101(netdata) gid=101(netdata) groups=101(netdata),101(netdata)\r\n\r\n# tail /etc/group\r\nutmp:x:406:\r\nping:x:999:\r\nnogroup:x:65533:\r\nnobody:x:65534:\r\nnetdata:x:101:netdata\r\n```\r\n\r\n## Solution\r\n\r\nIn alpine the group `ping` has gid 999 (docker)\r\nthe correct fix is to add netdata to the ping group which has gid 999 in alpine:\r\n\r\n`addgroup netdata ping`\r\n\r\nshould be added to https://github.com/firehol/netdata/blob/master/Dockerfile.alpine#L44\r\nor workaround: \r\ncommand: `bash -c 'addgroup netdata ping && exec /usr/sbin/netdata -D -s /host -p 19999`\r\n\r\nI use the following docker-compose.yml file to run netdata  in docker container with access to host network (for network metrics).\r\nfor use with letsencrypt-nginx-proxy-companion by Evert Ramos\r\nhttps://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion\r\n\r\n## docker-compose.yml\r\n```\r\n# docker-compose.yml\r\n# netdata in docker container with access to host network (for network metrics).\r\n# for use with letsencrypt-nginx-proxy-companion by Evert Ramos\r\n# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion\r\n# uses socat to proxy netdata to reverse proxy\r\n# a separate network is defined to bind netdata to a fix ip address\r\n# this ip address is used for the socat target\r\n#\r\nversion: '3'\r\nservices:\r\n  netdata:\r\n    image: firehol/netdata:alpine\r\n    hostname: example.com # set to fqdn of host\r\n    cap_add:\r\n      - SYS_PTRACE\r\n    volumes:\r\n      - /proc:/host/proc:ro\r\n      - /sys:/host/sys:ro\r\n      - /var/run/docker.sock:/var/run/docker.sock:ro\r\n      #- ./netdata.conf:/etc/netdata.conf:ro\r\n    network_mode: host\r\n    command:  /usr/sbin/netdata -D -s /host -p 19999 -i 192.168.88.1\r\n    # WORKAROUND add netdata to ping group (gid 999) for access to docker.sock\r\n    #command:  bash -c 'addgroup netdata ping && exec /usr/sbin/netdata -D -s /host -p 19999 -i 192.168.88.1'\r\n\r\n  socat:\r\n    image: alpine/socat:latest\r\n    environment:\r\n      - VIRTUAL_HOST=netdata.example.com\r\n      - LETSENCRYPT_HOST=netdata.example.com\r\n      - LETSENCRYPT_EMAIL=your_email@domain.com\r\n      - VIRTUAL_PORT=19999\r\n    entrypoint: socat TCP-LISTEN:19999,nodelay,fork,reuseaddr TCP:192.168.88.1:19999\r\n    expose:\r\n      - 19999\r\n    networks:\r\n      - webproxy\r\n      - netdata\r\n\r\nnetworks:\r\n  webproxy:\r\n    external:\r\n      name: webproxy\r\n  netdata:\r\n    driver: bridge\r\n    ipam:\r\n      driver: default\r\n      config:\r\n        - subnet: 192.168.88.0/24\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/firehol/netdata/issues/comments/407152930","html_url":"https://github.com/firehol/netdata/issues/3972#issuecomment-407152930","issue_url":"https://api.github.com/repos/firehol/netdata/issues/3972","id":407152930,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzE1MjkzMA==","user":{"login":"paulfantom","id":3531758,"node_id":"MDQ6VXNlcjM1MzE3NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/3531758?v=4","gravatar_id":"","url":"https://api.github.com/users/paulfantom","html_url":"https://github.com/paulfantom","followers_url":"https://api.github.com/users/paulfantom/followers","following_url":"https://api.github.com/users/paulfantom/following{/other_user}","gists_url":"https://api.github.com/users/paulfantom/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfantom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfantom/subscriptions","organizations_url":"https://api.github.com/users/paulfantom/orgs","repos_url":"https://api.github.com/users/paulfantom/repos","events_url":"https://api.github.com/users/paulfantom/events{/privacy}","received_events_url":"https://api.github.com/users/paulfantom/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T18:18:18Z","updated_at":"2018-07-23T18:18:18Z","author_association":"MEMBER","body":"@pgassmann I have started #3995 so we could collaborate on this :smile:\r\n\r\nCurrently problem from #3972 (this issue) is still present."}}
{"actor":{"display_login":"paulfantom"}}