Hello,
What I am trying to do.
I want to create a regression test for the service of Telegraf. This can essentially be done by running `telegraf --test`. As we are running this with a docker-compose definition we would like to use this same docker-compose to run the test.
As Telegraf is also collecting docker metrics, we also need to mount the `docker.sock`.
version: '3.7'
services:
telegraf:
image: telegraf:1.18.3-alpine
restart: unless-stopped
environment:
- TELEGRAF_HOSTNAME=${TELEGRAF_HOSTNAME:?}
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /var/run/docker.sock:/var/run/docker.sock
The issue
It seems that Telegraf cannot authenticate against the docker.sock API:
2021-08-11T07:40:12Z E! [inputs.docker] Error in plugin: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.21/info": dial unix /var/run/docker.sock: connect: permission denied
2021-08-11T07:40:12Z E! [inputs.docker] Error in plugin: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.21/containers/json?filters=%7B%22status%22%3A%5B%22running%22%5D%7D&limit=0": dial unix /var/run/docker.sock: connect: permission denied
What I tried
I do not seem to be able to locate the `/var/run/docker.sock` inside of the pipeline using the following step definitions:
- step:
name: "Test Telegraf config"
services:
- docker
script:
- cd ${BITBUCKET_CLONE_DIR}/telegraf
- TELEGRAF_HOSTNAME=$(hostname) docker-compose run telegraf telegraf --test
How can I use the docker.sock that is required by the services I try to test?
+1 also facing this issue, which is kinda blocking me from running E2E tests properly.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.