Running docker commands on a container after its built

After I build my image using Circle CI, how do I run a command on the container? Right now, I’m running my tests, then building the container (which essentially means im building it twice). I’dlike to build only once and then run all commands I need against the original container

spec:
  containers:
  - name: container-name
    image: gcr.io/project/container:latest
    imagePullPolicy: Always
    command: ["yarn", "start:worker"]

Normally one would use docker exec, but you do not have “host” access inside your primary container, since that is a guest.

My first thought is, does the Yarn worker have a listener that accepts commands? What does a Yarn worker do?

Failing that you can always use a Docker image as the base of your primary container, then install Docker Compose manually, and then pull in your images manually. It is a bit more work, but you get all the control of Docker Compose as if you were running it locally. (This is essentially Docker-in-Docker).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.