# Build Docker Image then Use that Image?

**URL:** <https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754>\
**Category:** Build Environment\
**Created:** [March 4, 2019, 10:07pm UTC](https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754 "2019-03-04T22:07:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![naftulikay](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/naftulikay/32/18002_2.png) [@naftulikay](https://discuss.circleci.com/u/naftulikay)\
**Post date:** [March 4, 2019, 10:07pm UTC](https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754/1 "2019-03-04T22:07:51Z")

</div>

I have a repository which needs only a handful of things. I’d like to simply create a Dockerfile in the root and have CircleCI build that Docker image and then _use_ that Docker image for the remaining tasks in the pipeline.

Is there a way to have CircleCI `docker build -t naftulikay/myrepo:latest` and then use that built image locally for subsequent steps?

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [March 4, 2019, 10:50pm UTC](https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754/2 "2019-03-04T22:50:45Z")

</div>

Not currently, but we have a feature request here [https://circleci.com/ideas/?idea=CCI-I-130](https://circleci.com/ideas/?idea=CCI-I-130)

Please vote to show interest and track updates and feel free to comment to add thoughts or clarify.

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [March 5, 2019, 8:56am UTC](https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754/3 "2019-03-05T08:56:09Z")

</div>

I think this is possible already - just make it two projects (i.e. two jobs). The thing that builds your build image and what you do with it are two separate tasks - the first is CI tooling and the second is your project under CI. When building your build image, push it to a private registry, and when doing the rest of your pipeline, pull the image from the private registry.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [March 15, 2019, 9:04am UTC](https://discuss.circleci.com/t/build-docker-image-then-use-that-image/28754/4 "2019-03-15T09:04:56Z")

</div>

Closed on March 15, 2019, 9:04am UTC

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