Since you have built your own container image in the previous lesson, now it is time to deploy and run it on the computer on module.
In this section, you will:
- Pull the generated image from Docker Hub.
- Run the image on the device.
Typographic Conventions
Throughout the Torizon documentation, the following typographic conventions are used:
$ (dollar sign) Command in the host computer (e.g. your PC)
$ Command in your PC
$$ (double dollar sign) Command in a container in the host computer (e.g. your PC)
$$ Command inside a container in your PC
# (hashtag) Command in the target device/board (e.g. Linux terminal)
# Command in the target board, e.g. Colibri iMX6
## (double hashtag) Command inside a container in the target device (Torizon)
## Command inside a container in Torizon
> (greater-than sign) Command in the bootloader (e.g. U-Boot console)
> Command in the Bootloader
No symbol: Command output
$ Command waiting for output
Output
For this Quickstart Guide:
- Development computer with Windows 10 version 2004 (a.k.a. May 2020 update) or higher.
- Successfully completed the previous lesson from this guide.
Note: Carefully read this module's cover page clicking on "Module 3: Creating my Own Container" on the left menu bar before starting this lesson.
On the board, make sure there are no running containers:
# docker stop $(docker ps -a -q)
Pull the image you just pushed to Docker Hub (See the previous lesson if you didn't) :
# docker pull <username>/gs-torizon
You can use the same command above to pull new container image versions every time a new one is pushed to Docker Hub.
The following command starts a new container based on the Docker image and open the new container's terminal:
# docker run --rm -it -v /var/run/dbus:/var/run/dbus -v /dev:/dev <username>/gs-torizon
Check that the package you've installed in the Dockerfile is available in this new container:
## nano
You are now inside the nano
text editor. Press Ctrl + x
to exit it.
Note: Please, note that all the changes made in a container after its creation will be lost when the container exits. To keep data, one needs to use methods to store data outside the container, for example, by using bind mounting.
You can exit the container by either typing exit
on the command-line or by pressing Ctrl + d
:
## exit
What does docker ps -a -q
do?
The fastest way to understand it is by running
docker ps --help
, either on the board or your computer:
$ docker ps --help
Usage: docker ps [OPTIONS]
List containers
Options:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show n last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
Or you can consult the online Docker documentation, which is more comprehensive and has some usage examples: