Attach to docker container that is started when using CircleCI Local CLI

I’m using the circleci tool to locally test my circleci configs and I’m wondering if it’s possible to attach to the docker container that’s started after executing circleci local execute -c process.yml .

I’m building a project and I want to inspect if some of the build results are correct and if certain files have been generated with the correct contents during the build process.

I’ve had good success with running docker ps, locating the correct container, and then docker execing into it.

One nice thing is a run: while date; do sleep 60; done step. at the end that keeps the container alive until I whack C-c. If you’re having trouble with the steps running without error you can even throw a when: always or when: on_fail on that step so that it runs even when there’s been an issues earlier in the build.

It’s even fairly easy to automate this with a little scripting.

OTOH you might find it easier to simply put the tests directly into your configuration. If they’re valuable during development iteration they’re likely to be valuable for future verification.

Good luck!