In this section, we will see how to do this using two different methods: the Docker commit command and the Dockerfile automated build.
Building images
Docker commit
Let's start with an example and prepare an image with the Git and JDK toolkit. We will use Ubuntu 18.04 as a base image. There is no need to create it; most base images are available in the Docker Hub registry:
- Run a container from ubuntu:18.04 and connect it to its command line:
$ docker run -i -t ubuntu:18.04 /bin/bash
We've pulled the ubuntu:18.04 image, run it as a container, and then called the /bin/bash command in an interactive way (-i flag). You should see the Terminal of the container. Since containers are stateful and writable, we...