Interacting with secondary images

There is not currently a way to run docker commands on the secondary containers. The main way you can communicate with them is via the network on their exposed ports. There is a blog article that talks about some workarounds and explains the situation fairly well. But basically you need to do something tricky like run a resource inside the Solr container that listens on a port and can take in that file.

With that that said, have you considered using a machine executor instead? The machine executors come with Docker and Docker Compose preinstalled. You could drop a docker-compose.yml file in your .circleci folder right next to you config.yml

With the machine executors you are basically just in a straightforward VM and can do things like mount files on the local file system from your repository directly into that Solr container in your Docker Compose config.

While the Docker instances have a some advantages, there tends to not be a massive difference in startup time and for projects that don’t fit neatly into a Docker instance, they can be a solid solution.

1 Like