Outline

Creating Images

To create a new Dockerfile with Vim: $ vim Dockerfile

Now you can add the following lines to the beginning of your image:

An image can be built on top of an already existing image by including it at the very beginning of your Dockerfile with FROM [image_name]:[tag].

RUN executes shell commands in the context of your Dockerfile. For example, the following intsalls the Alpine package manager:

RUN apk update
RUN apk add bash

Adding CMD here defines the default command that will run when this container starts.

Back in your terminal, build your image into a container with $ docker image build -t [image_name]:[tag] [directory] and then run the newly created image with a similar command: $ docker container run -it [image_name]:[tag]

 

I finished! On to the next chapter