Docker-compose up


I’m new to CircleCI and I haven’t set up too many CIs in general yet.
My project is dockerized. It has a docker-compose.yml that runs postgres and an image that it builds from Dockerfile.

I want my tests in CI to be run inside the docker container by using the same docker-compose.yml. From what I’ve seen you’re building your docker environment inside the circleci config. But I don’t want to repeat myself in this file. It’s not DRY. I wish that I would bet let to just run docker-compose up and then run my test suite. It should also cache the docker images.

Can someone guide me in the right direction?

Hi @mg98! We offer a machine executor, which would allow you to run Docker and docker-compose commands as you normally would: However, the images may not be cached. The best way would be to utilise the Docker executor with multiple images, which would increase the chances of the image being cached: While I understand the want to not repeat configuration, there can be advantages to doing so, such as fine-tuning the image used (e.g using one of our convenience images in the pipeline, and a custom image locally).

Hello @gmemstr! Thanks for the explanation. I’m confused by the phrase “increase the chances of the image being cached” That’s not how computers work, is it? :joy: Can you elaborate on that? :slight_smile: In which circumstances would the image be cached on a machine executor for example?