Testing with a fresh built docker image



We have a Dockerized PHP application that we currently test, build and deploy to Elastic Beanstalk using 1.0.

I’m now looking at rewriting the CircleCI builds completely for 2.0, mainly in the hope that it will be less hacky from a docker perspective. I have to admit I am finding the 2.0 documentation a real struggle. There seems to be so much ambiguity especially regarding setup_remote_docker and quite what runs where once that has been called.

Anyway, my plan is to setup a workflow of three jobs with self-explanatory names: build, test, deploy.

The build job will:

  • checkout
  • Call setup_remote_docker and build the application from a Dockerfile.

Then, the test job will:

  • Use the built image from build as the primary container (and a mysql container as a secondary)
  • Run some tests

Finally, the deploy job will:

  • Push the docker image that was built in the build job to DockerHub
  • Deploy that image to Elastic Beanstalk.

My question is, will the built image from build even be available to the test and deploy jobs, or will it only be available in the remote docker environment which will be torn down by then? Note that I don’t intend to push it to DockerHub at the end of the build job and then pull it down for the test and deploy jobs as that seems unnecessary (and slow)

As a slight aside, any comments on whether this is a sane pipeline would be gratefully received.



Hey @mf-lit to answer your specific questions (as best I can), then the built image will only be available in the remote docker environment, unless you do a docker save to pull into a local tar file and persist that in your workspace or in a cache to be picked up by your follow-on jobs.

I was doing that before, but have actually now switched to doing the full push/pull from a registry as it is surprisingly quick to do that.

You will need to do that anyway if you intend to use your built image as the primary container for your test job, as you will need to reference that from a registry somewhere.

In terms of sanity, I don’t think you should be committed for it :wink:


Thanks @edkellena. Makes sense, seems so inefficient but I can understand that it’s necessary.


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