Open gouravbansal11 opened 4 years ago
@gouravbansal11 : Could you please elaborate your use case? What do you mean by merging two images? Not 100% sure but I think maybe you're looking for Dockerfile
I have one base image which I want to use in my application. Apart from that, I have another image that contains scripts. In my final image, I want resources from a base image as well as resources from a scripts image.
With Docker you can only easily use inheritance, not composition. So you need to build up a inheritance chaing: base -> script-image -> final-image
You can use a multi-stage build to achieve this.
If you have published your base image as my-co/base:latest
and your scripts image as my-co/scripts:latest
and you are writing the Dockerfile for my-co/app:latest
, you could write:
FROM my-co/base:latest
COPY --from=my-co/scripts:latest /scripts /my-co/scripts
RUN echo "Some other task"
Check the Docker documentation for multi-stage builds, particularly under Use an external image as a "stage".
How to use multi-stage build in pom.xml using docker-maven-plugin?
You can leverage the Dockerfile mode as described in the documentation.
Description
I wanted to merge 2 images and add my application to these images and create the final one. I tried to find any example but I didn't get. is it supported by this plugin? Could you please help me with an example.