Search by Tags

Writing Your First Dockerfile - ARM64


Your progress



Up to this point, you have been running pre-existing images from Docker Hub, built by Toradex or other third-party. But it is possible to create your own Docker image to load whatever application you wish. To fulfill this goal, the Dockerfiles exist.

In this section, you will:

  • Write a Dockerfile.
  • Build a Docker image from the Dockerfile.
  • Upload the image to Docker Hub.
Typographic Conventions


For this Getting Started Guide:

  • Development computer with Ubuntu 18.04 LTS.
    • Commands and instructions may vary slightly on other Ubuntu releases and Linux distributions.
  • Successfully completed the previous lessons from this guide.

For this lesson:

  • Docker downloaded and running.

Note: Carefully read this module's cover page clicking on "Module 3: Creating my Container" on the left menu bar before starting this lesson.

Step 1

In your Linux machine, create a new folder named getting-started on the Desktop and a new file called Dockerfile inside it.

$ mkdir ~/getting-started
$ touch ~/getting-started/Dockerfile

Copy the following content into the newly created file:

Note: a standard Dockerfile has no extension, therefore make sure your file is not named Dockerfile.txt, especially since file extensions are hidden by default. Consult this lesson's FAQ for details about naming.

FROM torizon/arm64v8-debian-base RUN apt update && apt install nano -y

Note: If you wish, modify the Dockerfile to include more commands, such as RUN apt install python.

In this example, the FROM command shows where to get the base of our Docker image. If you want to cross-build it, make sure to choose a pre-built image for ARM. We also run some commands to install packages from Debian feeds, to test if the cross-build really works.

Step 2

On your computer terminal, login to the Docker CLI:

$ docker login

Follow the prompt with your Docker Hub credentials. Visit Docker Hub page to create a Docker ID if you don't have credentials.

Step 3

Enter your getting-started folder and build the image:

$ cd ~/getting-started
$ docker build -t <username>/gs-torizon .

Step 4

Upload the image to your Docker Hub:

$ docker push <your-username>/gs-torizon


What is a Dockerfile?
Can I have multiple Dockerfiles with different names?