Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,920
Community Members
 
Community Events
177
Community Groups

How to mount docker.sock?

Edited

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 answer

+1 also facing this issue, which is kinda blocking me from running E2E tests properly.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events