1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Docker

Exercise

Creating your own Dockerfile

While it's possible download images for many use-cases. Often an image is not exactly what you need. In that case all you need to do is create a new image based on an existing image that comes close to your use case. Let's go through every step to create a Dockerfile from scratch to build on top of the existing ubuntu image, add instructions and then build it into an image.

Instructions 1/4

undefined XP
  • 1
    • Create a file called Dockerfile in the current working directory.
  • 2
    • Add the first instruction to the Dockerfile so that it will build on top of the ubuntu image.
  • 3
    • Add instructions to the Dockerfile so that it runs apt-get update and apt-get install -y python3 when building the Dockerfile.
  • 4
    • Using the terminal, run the command to build an image called my_python_image from the Dockerfile in your current working directory.