# How do I reuse the same image across multiple services?

**URL:** <https://community.okteto.com/t/how-do-i-reuse-the-same-image-across-multiple-services/1195>\
**Category:** How Do I?\
**Created:** [January 19, 2024, 10:48pm UTC](https://community.okteto.com/t/how-do-i-reuse-the-same-image-across-multiple-services/1195 "2024-01-19T22:48:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/ramiro/32/6_2.png) [@ramiro](https://community.okteto.com/u/ramiro)\
**Post date:** [January 19, 2024, 10:48pm UTC](https://community.okteto.com/t/how-do-i-reuse-the-same-image-across-multiple-services/1195/1 "2024-01-19T22:48:41Z")

</div>

I have a docker compose file where two services use the same image (different roles for the same binary). How can I tell okteto to build and push the image only once?

---

<div class="post-metadata">

**Author:** ![pchico83](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/pchico83/32/25_2.png) [@pchico83](https://community.okteto.com/u/pchico83)\
**Post date:** [January 22, 2024, 8:28am UTC](https://community.okteto.com/t/how-do-i-reuse-the-same-image-across-multiple-services/1195/2 "2024-01-22T08:28:52Z")

</div>

The best way is to refer your docker compose file from an okteto manifest like this:

```yaml
# okteto.yaml
deploy:
  compose: docker-compose.yml

```

Then, add a build section to your okteto manifest like this:

```yaml
# okteto.yaml
build:
   app:
      context: .
deploy:
  compose: docker-compose.yml

```

and finally, refer to this image from your docker compose file like this:

```yaml
# docker-compose.yaml
services:
  api:
    image: ${OKTETO_BUILD_APP_IMAGE}
    ports:
      - 8080:8080
    command: python app.py
  worker:
    image: ${OKTETO_BUILD_APP_IMAGE}
    command: python worker.py

```
