Use previously built docker image in a later step


I am building a docker image for our app with all the javascript minified and so on and I want to run end-to-end tests on that image prior to deployment. Ideally I could specify the docker image in the docker section of the build step. However, I the image tag to use depends on CIRCLE_SHA1, e.g. ${CIRCLE_BRANCH}-${CIRCLE_SHA1}

Can the docker image contain environment variables in circle.yml?


Do you mean the Docker image name?


Just the tag.


  - image: my/image:${CIRCLE_BRANCH}-${CIRCLE_SHA1}


Gotcha. Have you tried it? I would guess it doesn’t work, but it may be worth a try.

Failing that, you can use Docker to pull in an image, or build an image. Since that’s a regular Linux command, you can use env vars there.


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