Exercise Solution

In this lesson, we will go over the step-by-step solution for the exercise: Build an Image and Run It.

  • Create a file named Dockerfile and add the following code to it:
Dockerfile
  • Open a command-line. Change the current directory to the directory where you created the Dockerfile and the compute.js file

  • The following command will build your docker image.

  • Run the following command once the image has been built, it will start the container and run your image.

Run the following to see the output. The commands to build and run the Dockerfile will be automatically executed.

/
Dockerfile
compute.js

In the next lesson, let’s start our discussion on tags.

Exercise: Build an Image and Run It
Tags Matter
Mark as Completed
Report an Issue