# Can I build an image, not publish it, and use it in child pipeline?

**URL:** <https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511>\
**Category:** Pipeline Workflows\
**Created:** [February 26, 2021, 5:01pm UTC](https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511 "2021-02-26T17:01:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![valwork2021](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/valwork2021/32/328_2.png) [@valwork2021](https://community.codefresh.io/u/valwork2021)\
**Post date:** [February 26, 2021, 5:01pm UTC](https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511/1 "2021-02-26T17:01:35Z")

</div>

Can I build an image, not publish it, and use it in another child pipeline?

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [March 2, 2021, 8:09am UTC](https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511/2 "2021-03-02T08:09:02Z")

</div>

Hello

No. Child pipelines share nothing with the parent pipeline (apart for build parameters). The only way is to push the image to a registry.

This happens because a child pipeline can run in a different build node than the parent one (and in most cases it is a different node). So all the images built by the parent pipeline are not present on the execution context of the node that runs the child pipeline.

If you are worried about space/cost, there are many registry services with free tiers that you can use for temporary docker images.

---

<div class="post-metadata">

**Author:** ![valwork2021](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/valwork2021/32/328_2.png) [@valwork2021](https://community.codefresh.io/u/valwork2021)\
**Post date:** [March 3, 2021, 12:34pm UTC](https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511/3 "2021-03-03T12:34:31Z")

</div>

I am trying to avoid YAML code duplication.  
If CF had something like #include feature…

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [March 3, 2021, 1:07pm UTC](https://community.codefresh.io/t/can-i-build-an-image-not-publish-it-and-use-it-in-child-pipeline/511/4 "2021-03-03T13:07:18Z")

</div>

For small YAML snippets you might find useful YAML anchors useful [Codefresh YAML · Codefresh | Docs](https://codefresh.io/docs/docs/codefresh-yaml/what-is-the-codefresh-yaml/#using-yaml-anchors-to-avoid-repetition)

Regarding the include feature, we don’t have that right now. The approach we propose is to reuse the whole pipeline if possible [Building Microservices · Codefresh | Docs](https://codefresh.io/docs/docs/ci-cd-guides/microservices/#reusing-pipelines-for-microservice-applications)
