Spread the love

 160,807 views

Starting with v4.2.1, NVIDIA JetPack includes a beta version of NVIDIA Container Runtime with Docker integration for the Jetson platform. This is essential because it enables users to run GPU accelerated Deep Learning and HPC containers on Jetson devices. This sounds good but to build, deploy and scale microservices, you will require Docker Compose. Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

Running Docker Compose on Jetson Nano can be a daunting task. You just can’t use the usual curl command to get it installed. In this blog post, I will show you how to get Docker and Docker Compose installed on your NVIDIA Jetson Nano board in 5 minutes.

Hardware

  • Jetson Nano
  • A Camera Module
  • A 5V 4Ampere Charger
  • 64GB SD card

Software

Preparing Your Raspberry Pi Flashing Jetson SD Card Image

  • Unzip the SD card image
  • Insert SD card into your system.
  • Bring up Etcher tool and select the target SD card to which you want to flash the image.
My Image

Verifying if it is shipped with Docker Binaries


ajeetraina@ajeetraina-desktop:~$ sudo docker version
[sudo] password for ajeetraina: 
Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:47:53 2020
 OS/Arch:           linux/arm64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:       

Checking Docker runtime

pico@pico1:/tmp/docker-build$ sudo nvidia-docker version
NVIDIA Docker: 2.0.3
Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:47:53 2020
 OS/Arch:           linux/arm64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:

Installing Docker Compose on Jetson Nano

Jetson Nano doesn’t come with Docker Compose installed by default. You will need to first install the below list of pre-requisite packages in the right order as shown below:

export DOCKER_COMPOSE_VERSION=1.27.4
sudo apt-get install libhdf5-dev
sudo apt-get install libssl-dev
apt install python3
apt install python3-pip
sudo pip3 install docker-compose=="${DOCKER_COMPOSE_VERSION}"
pip install docker-compose

Please note that docker compose require python 3.x. I would suggest you to remove Python 2.7 or lower versions if it exists for the smooth installation of the packages.

Verify Docker Compose installation

docker-compose version
docker-compose version 1.26.2, build unknown
docker-py version: 4.3.1
CPython version: 3.6.9
OpenSSL version: OpenSSL 1.1.1  11 Sep 2018

Let’s run Minecraft server using docker compose. First we will create a docker compose file as shown below:

pico@pico1:~$ cat docker-compose.yml 
version: '3.7'
services:
 minecraft:
   image: itzg/minecraft-server:multiarch
   ports:
     - "25590:25565"
   environment:
     EULA: "TRUE"
   deploy:
     resources:
       limits:
         memory: 1.5G

Running the Minecraft Server

sudo docker-compose up
WARNING: Some services (minecraft) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
Creating network "pico_default" with the default driver
Creating pico_minecraft_1 ... done
Attaching to pico_minecraft_1
minecraft_1  | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 Aug  9 18:11 /data'
minecraft_1  | [init] Resolved version given LATEST into 1.16.3
minecraft_1  | [init] Resolving type given VANILLA
minecraft_1  | [init] Downloading minecraft_server.1.16.3.jar ...
minecraft_1  | [init] Creating server.properties in /data/server.properties
minecraft_1  | [init] Setting server-name to 'Dedicated Server' in /data/server.properties
minecraft_1  | [init] Skip setting server-ip
minecraft_1  | [init] Setting server-port to '25565' in /data/server.properties
....

In my future blog, I will show you how to use Docker Compose for NVIDIA Jetson Nano GPU for the first time.

Clap


Spread the love
Categories: Docker

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019): Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco, and secondly, “2019 Docker Community Award“. I run Collabnix Community Slack with over 5300+ audience . I have built popular GITHUB repositories like DockerLabs, KubeLabs, Kubetools, RedisPlanet Terraform etc. with the support of Collabnix Community. Currently working as Developer Relations Manager at Redis Labs where I help customers and community members adopt Redis. With over 12,000+ followers over LinkedIn & close to 5100+ twitter followers, I like sharing Docker and Kubernetes related content . You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

5 Comments

Anon · 22nd December 2020 at 5:42 am

Thanks for the tutorial, as a side note for anyone else that may run into issues. I also had to install ” libffi-dev” in my Jetson Nano (4GB RAM model) to get docker to install using pip3/pip.

    Anon · 22nd December 2020 at 5:44 am

    Correction: the above post is to install docker COMPOSE not docker. So you may need to install ” libffi-dev” on your jetson to install docker compose

      Ajeet Raina · 25th December 2020 at 10:42 am

      Without installing Docker, how can you leverage Docker Compose?

Ignacio Rodriguez · 14th February 2021 at 12:56 am

Thank you very much for the material, now I installed docker compose in Jetson Nano from the beginning and everything worked, I add that in my case, the pip update helped to complete the installation, greetings.

Ravishankar · 25th March 2021 at 9:40 pm

I want to prepare a docker container on jetson nano for an application. The application is a hw accelerated mpv player with custom ffmpeg libraries.

https://forums.developer.nvidia.com/t/hardware-decoding-in-mpv-player/75872/6?u=rreddy78

How can I go about this. I need some base image to start with before I install the packages into the container. Any ideas/hints ?

Leave a Reply to Ravishankar Cancel reply

Your email address will not be published. Required fields are marked *