Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
1. Overview
This application note explains how to use the Docker platform in the Emcraft software distribution for the Renesas RZ/V2H SoC.
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security lets you run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you don't need to rely on what's installed on the host. You can share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.
1.1. Running Docker
The docker
daemon starts up autonomously on boot-up of Linux on the target. No manual action is launched to launch the docker
.
To check everything is working, run the docker info
:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo docker info
Client:
Version: 24.0.5
Context: default
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version:
runc version:
init version:
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.10.145-cip17-0.0.1-34-12150405+gdf43561f711a
Operating System: Ubuntu 22.04.1 LTS
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 14.86GiB
Name: rzv2hevkalpha
ID: 42221a95-4bfc-4598-b9b9-3d65438145b2
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false |
1.2. Running “Hello, world!”
Pull and run the first Docker container, hello-world
:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo docker run hello-world |
The docker would download the hello-world
image and run it:
Code Block |
---|
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
70f5ac315c5a: Pull complete
Digest: sha256:3155e04f30ad5e4629fac67d6789f8809d74fea22d4e9a82f757d28cee79e0c5
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/ |
1.3. Post-install Configuration
If you want to run docker
without root privileges, add user
to the docker
group:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo usermod -aG docker $USER |
After you log out and log back, you can run docker
commands without sudo
:
Code Block |
---|
user@rzv2hevkalpha:~$ user@imx8mpnavq:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
user@rzv2hevkalpha:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd01f7523abb hello-world "/hello" 5 minutes ago Exited (0) 5 minutes ago happy_maxwell
user@rzv2hevkalpha:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest b038788ddb22 7 months ago 9.14kB |
2. Disabling and Enabling Docker
It may be useful to disable the docker
daemon service if it's not utilised in your target application. This would save some resources and improve the target boot time.
To disable the docker
service auto-start, run:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo systemctl disable docker
Removed /etc/systemd/system/multi-user.target.wants/docker.service. |
To enable the docker
service auto-start, run:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service. |
To manually stop the docker
daemon in the current session, run:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo systemctl stop docker |
To manually start the docker
daemon, run:
Code Block |
---|
user@rzv2hevkalpha:~$ sudo systemctl start docker |