Using an existing container

The easiest way to build a base image is to start off by using one of the official images from the Docker Hub. Docker also keeps the Dockerfile for these official builds in their GitHub repositories. So there are at least two choices you have for using existing images that others have already created. By using the Dockerfile, you can see exactly what is included in the build and add what you need. You can then version control that Dockerfile if you want to change or share it later.

There is another way to achieve this; however, it is not recommended or considered to be good practice, and I would strongly discourage you from using it.

I would only use this method during a prototyping phase to check that the commands ...

Get Mastering Docker - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.