1-vHow to Set Up the Environment Before Installation?
2- How to Install Docker from the Repository?
3- How to Install Docker from Package?
4- How to Install Docker from Convenience Script?
5- How to Run Docker Images in Container?
Ubuntu 18.04 LTS
In this blog post, we will explain three methods to install Docker on Jetson Nano. These methods work on other Jetson modules as well. You can review Jetson Nano Fanless Industrial PC - DSBOX-N2. Then, we will show how to run Docker images in a container.
In Forecr products, docker engine is installed during the set up. Check whether it is already installed in your Jetson by running the following command. If you see the following, then you can skip the installation part and move to running the docker container.
$ sudo docker version
Before we move into installation, we must set up the environment. Run the following commands to download needed packages.
sudo apt-get update
sudo apt-get install \
You need to add Docker’s official GPG key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Run the following command to set up the repository in Stable channel to download the latest version. You can also use Test channel to use pre-releases before general availability or Nightly channel to use the latest works in progress before the next major release.
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
How to Install Docker from the Repository?
Run the following commands to install Docker Community Edition from the GitHub repository.
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
You can again check whether it is installed by running the command at the beginning.
How to Install Docker from Package?
Go to https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/
Download containerd.io, docker-ce, docker-ce-cli packages with the versions you wish.
Containerd.io: High-level container runtime to create and run the containers
Docker-ce: Docker engine community edition
Docker-ce-cli: Command line interface for docker community edition engine
Install the packages using the following command. Write the path as where you downloaded the packages.
sudo dpkg -i /path/to/package.deb
How to Install Docker from Convenience Script?
You can also install Docker from a script provided in the following Github repository.
Run the following command to download the script.
curl -fsSL https://get.docker.com -o get-docker.sh
Build and run the script file.
sudo sh get-docker.sh
How to Run Docker Images in Container?
To test whether the docker is installed correctly, you can run a simple image called Hello-World in a container by using the following command. If the image is not downloaded before, “pull” command will also work behind to download the image.
sudo docker container run hello-world
You can download images from Docker hub using pull operation manually.
sudo docker pull [OPTIONS] NAME[:TAG|@DIGEST]
To run the images inside a container you can use the following command.
sudo docker container run [OPTIONS] IMAGE [COMMAND] [ARG…]
Now, let’s try to run containers from Ubuntu image. First, we need to download the docker image using “pull” command.
sudo docker pull ubuntu
Then, we can run ubuntu image in a container with different operations. We will show some simple commands, but you can check all of them using --help.
You can also specify the directory that you will create the docker by adding the path at the end.
Example commands to run the docker container:
sudo docker container run ubuntu ls
sudo docker container run ubuntu echo forecr
To run the docker container interactively, use -it operation.
--rm : Deletes the container automatically when it is done.
--network: Connects the container to a network, in this case it connects to host.
You can perform various tasks inside container and leave by typing “exit”.
sudo docker container run -it --rm --network host ubuntu
echo “hello world”>forecr.txt
-- volume: Accesses files outside the container
sudo docker container run -it --rm --network host –volume /home/nvidia ubuntu