Docker Community Forums

Share and learn in the Docker community.

Need to refer multiple docker images in one Dockerfile

docker

(Mythili) #1

Hi,
I need to refer more than one image in a Dockerfile. How can I do that? Say, I need to refer Ubuntu image first and then refer Java image. How can I achieve this?

Thanks.


(David Maze) #2

An image can only have one base image, so you can’t do this.

That having been said, from your description, you don’t really need more than one base. Either start from the prebuilt Ubuntu image, and apt-get install a JVM, or start from the prebuilt Java image, which will probably have a normal Linux userspace environment.

If you do find yourself needing multiple base images, you may be better served by splitting your system into multiple containers with separate concerns.