Docker Build

docker build command is used to create a docker image from Dockerfile.

To create an image, first lets create a working directory and change to the directory.

Create a file with name Dockerfile

Put following content in it

Now build the docker image with

This will create a docker image with name “my-ubuntu”.

To run this, we need to create a container using this image, this can be done with command

Here i used -ti as we need to run interactively using terminal, this is because our the command we set to start is “/bin/bash” in the Dockerfile.

Docker