0

I am working with building a build pipeline to generate an docker image for an Visual studio solution, which consist of multiple projects each with its own docker file.

Is it somehow possible to combine each of these containers into the same image?

0

1 Answer 1

1

You should avoid combining multiple containers into one image. As the answer to this thread pointed that images should be kept light, and run one service per container.

If you need multiple containers to run in your application. You should use Docker Compose to manage those services.

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration

Here is a simple Docker compose example.

And you can use Docker Compose task to build, push or run multi-container Docker applications in your azure devops pipelines. Check here to learn more about this task.

If docker compose is not fit for your case, You can have a try checking if you can use multiple stage dockerfile to combine these dockerfiles into one. This will end up with a single image when your run docker build.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi @kafka Did you check out above answer? How did it go with this case?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.