Difficulty: Basic
Estimated Time: 30 minutes

In this scenario you will learn about the basics on how to build an app using containers. You will create a Dockerfile and build a container based on it. Then you'll learn how to run a container based off of the container image you build and finally how to push it to a container registry.


You've master the first level of containerized apps building. You're a container Padawan now. Time for the next scenario where we'll have a look at how to deploy the app in Kubernetes.

Container Basics

Step 1 of 4

Understanding the Dockerfile

A Dockerfile describes how the container is supposed to be constructed. It's a bit like setting up software on a machine: you specify the steps to copy stuff around, install a package or maybe even build stuff from source. Let's have a look at a simple example, a Node.js app:

FROM mhart/alpine-node:8
MAINTAINER Michael Hausenblas 
COPY dok-example-us/stock-con/ .
RUN npm install express && \
    npm install
USER nobody:nobody
CMD ["node", "service.js"]

Now, paste above content—see the copy icon in the upper-right corner of above block—and it will be automatically saved in a file called (surprise!) Dockerfile in the current directory.