Hello there!
Lately, I’ve been setting up a new pipeline for one of my projects. It uses the cimg/openjdk:17.0.5 image, it checkout the code and run a gradle test
command for running unit tests which require that the Docker daemon is running to perform those involving Redis. As far as I can see, this steps fails because the daemon is not running. I’ve been trying for some days to make it work but I didn’t succeed.
I’ve tried using dockered
and also sudo /etc/init.d/docker start
, but nothing seems to work.
Can somebody help me please?
Thank you!
Hello
You can define multiple images, I would recommend setting both the OpenJDK and the Redis image as this will allow both to run at the same time.
We have information available linked here in regards to using databases on CircleCI: Configuring Databases - CircleCI
Once Redis is started we would recommend adding a wait to make sure that it is running before trying to connect as this can cause issues an example can be seen below taken from the database link above.
- Redis:
dockerize -wait tcp://localhost:6379 -timeout 1m
Kind Regards
Owen Oliver
Hi! Thanks for you reply.
Maybe I should explain better my problem.
My company uses CircleCI running through self hosted containers, which means that Docker commands cannot be executed (can’t use the set-up-remote-docker
command). That is fine for building and pushing images because we are using Buildah as suggested in the documentation.
However, in the first part of the pipeline, in which we build our jar artifact (using the image cimg/openjdk:17.0.5), the command gradle test
fails. That is because in our JUnit tests, we use “test-containers” which should spin up a new Redis container, just for tests purposes, but since Docker commands (and the docker daemon seems impossible to be started) cannot be executed, this procedure fails.
I was wondering if there is any solution to this. We have tried using another form of Redis Test (embedded redis in our Java code) and it works. But we need to be able to execute test containers for our tests.
Thank you in advance .