0

DockerFile – Build a Ubuntu 18.04 docker image and update it

This simple post demonstrates how to pull a Ubuntu 18.04 images and update the OS.

Stuff Used

  • Windows 10
  • Docker for Windows – Community Edition
  • PowerShell

DockerFile

First, we need to create a DockerFile file in some folder.

Using PowerShell

We start off with zero containers and images. This is not a requirement and there is no need to delete or remove existing containers and images.

Change Directory to Specific Directory

We change directory to the directory where the DockerFile is.

To verify the current directory, use:

Then, build an image based on our DockerFile that is inside that directory.

This will kick start the build process as follows.

Once it is done, we get the following.

To list the new images, use:

Interactively Run Container

Now we can test our image interactively:

To ensure we use local image only, we create and run a container using an Image ID.

Alternatively, we could still use:

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert