Docker is a platform full of applications, called containers. Containers are isolated solutions, thus they don't have to depend on your environment. Making them portable and consistent throughout development, testing, and production.
You can download, install, use, and share applications in the form of containers. You can find all the available container images on the hub.docker.com page.
In this tutorial, we will go through the steps of how to install, run and remove Docker's official Hello-World image
Make sure to have the Portenta X8 with the latest image as well as the bootloader. Please check how to flash your Portenta X8 to have the latest version.
The Portenta X8 provides Docker CLI by default. The following command will help you verify if it is installed correctly:
To use this tool, you will need to connect to your device first. Check how to connect using adb/ssh.
You can check Docker's reference documentation, which covers all the features of the tool in depth at docs.docker.com.
The following steps will show how to install, run and uninstall the "Hello World" container.
To avoid a lack of permissions while launching
, you may type the following:
newgrp - docker
The previous command and other important info about Linux on your Portenta are described in the Portenta X8 User Manual.
First, you will need to search for "Hello World" container image. The container image can be found within the Docker hub, where you will be able to find a variety of readily-available container images. It will be used to verify docker is working as intended with the Portenta X8.
The following command must be used to pull the
image. The Docker hub page for images has the instructions to pull the image and deploy the container.
1docker pull hello-world
This is the command to begin the container instance.
1docker run hello-world
To be able to see an active container with
, you will need to run it at least once with
docker ps -a
The following command will display the active containers and will show the
container if it was able to run successfully. The
message will let you know if the container is active or has finished operation depending on its purpose.
1docker ps -a
The list of available images, including installed
image, can be verified using the following command:
You will need to obtain an assigned
to be able to remove a container of your choice. The list of active containers provides this information. The remove (
) command is then used with the desired container identifier to proceed with the removal process.
1docker container rm <CONTAINER ID>
For this example, the command
will show the
docker ps -a
container designated as:
. If you encounter an error stating that the container cannot be removed, it may mean that the container has an actively ongoing operation which can be checked with
Granted that this is the case, you will need to stop the container and verify with
message that it has exited successfully. To do this, the following command is used:
1docker stop <CONTAINER ID>
Every time the image is re-installed or re-ran, the
will be different than the previous identifier
after container removal, the
docker ps -a
container should no longer be present as an active container.
The same goes for the images if you would like to free some space. The removal command will now be as follows using
found within the image table:
1docker rmi <IMAGE ID>
If you run
again, you will see that the
image is not showing up anymore.
In this tutorial, you have learned how to use Docker with Portenta X8. You have learned to download an image, manage, and deploy the container, and ultimately run on Portenta X8. You have also learned to remove the image and the container to control Portenta X8's available resources.