Docker Community Forums

Share and learn in the Docker community.

Multiple image repositories in one docker compose

Hello. I have three images from different projects (each project in a separate repository).
Main API which uses Project2 and Project3 API.
Code in Project1 to get data from project2 and project3 API:

<add key="project2" value="http://container_name_project2Api:44333/api/" />
<add key="project3" value="http://container_name_project3Api:3000/api/" />

I refer to them through the container name in Project1. For now, I have to pull three images then create a container for each image and run it. It’s possible to run all three API in one docker-compose?

Yes. Just configure the urls in the value attribute to access the service names you define for the respective service, instead of container_name_project?Api. There is no need to publish ports for project2 and project3 if they should only by accessible thru project1.

1 Like