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

Pipelines: accessing redis-server via unix domain socket not working

kumaakh July 29, 2021

I have a public docker image which has redis and maven. My Junit testcases access redis-server via unix domain socket. This image has been working fine on gitlab pipeline for more than 1 yr now. 

Today I started setting up a pipeline on bitbucket and for some reason my tests now fail with 
"Failed connecting to /var/run/redis/redis.sock"
...
Caused by: java.net.SocketException: No such file or directory

The same docker image I can pull and check locally via redis-cli that it can connect to redis-server via the same UDS. 

So in a nutshell
-works on locally running docker
-works on gitlab pipeline
-does not work with bitbucket pipeline.

Does bitbucket pipeline launches these dockers in a special manner that applications do not see anything outside home directory ? 
Any known work arrounds... I guess I can test with localhost:6379 but that leaves a bad taste. 

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2021

Hi @kumaakh

Thank you for reaching out to the community.

Would it be possible for you to confirm if you're running your public Docker image (with the redis and maven) as a service container on Pipelines?
Or you're using it as a base Docker image?

If you're using it as a service similar to the public documentation here, I'm afraid it will only be accessible on localhost:6379.

Regards,
Mark C

kumaakh August 26, 2021

Hello Mark, 

redis, maven etc. are all installed on my base docker image. I am running a single main container and no service containers.  If it helps here is the public image from hub.docker.com

 

image: kumaakh/rockbuild:v1.3
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2021

Hi @kumaakh

Thanks for the confirmation.

I've tried pulling your public Docker image locally and I did see redis is installed in your Docker image using the redis-cli command.

In this case, would it be possible for you to debug your Pipelines build locally using your public Docker image and perform the JUnit testcases?

Ideally, if it is working locally in a non-interactive shell, it should work as well on Pipelines.

Let me know how it goes.

Mark C

kumaakh August 27, 2021

Mark thanks,
This was very useful... I could fix the issue by using the suggested debugging approach. I had to start the redis-server as a background process as part of the script and my tests pass now. 

Like Mark C likes this
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 29, 2021

Hi @kumaakh

Great! Glad to know debugging your build locally helps.

Let me know if you have further questions that I can help with.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events