Last Updated on : 2023-12-07 03:02:55download
Docker supports both x86_64 architecture computers and Arm architecture computers. This topic describes how to install Docker on Raspberry Pi that uses ARMv7. These steps apply when you deploy Tuya Edge Gateway (TEdge) in containers. For more information, see Docker Desktop overview.
Docker supports Raspberry Pi OS Buster.
Note: Debian-based Raspberry Pi OS is supported by the Raspberry Pi Foundation, the organization that develops and maintains Raspberry Pi. It is the preferred operating system recommended for Raspberry Pi. For more information, see Raspberry Pi OS and Raspberry Pi Foundation.
Note: If Docker APT sources are not configured, do not use APT to install Docker.
The APT sources use HTTPS to ensure that software is not tampered with during the download process. Therefore, you must add the software package and Secure Sockets Layer (SSL) certificate that support HTTPS transmission before the download.
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
lsb-release \
software-properties-common
Note: If you want to deploy Docker in mainland China, to minimize the impact caused by the networking limits, we recommend that you use APT sources that are deployed in mainland China. For more information about the official sources, see the comment in the code.
To confirm the validity of the downloaded software package, you must add GNU Privacy Guard (GPG) keys to software sources.
$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/raspbian/gpg | sudo apt-key add -
# Official source
# $ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
Add the Docker software sources to sources.list
.
$ sudo add-apt-repository \
"deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/raspbian \
$(lsb_release -cs) \
stable"
# Official source
# $ sudo add-apt-repository \
# "deb [arch=armhf] https://download.docker.com/linux/raspbian \
# $(lsb_release -cs) \
# stable"
The preceding code block is used to add stable Docker APT sources. If you require the test version of Docker, change stable
to test
.
Update the cached APT packages and install docker-ce
.
$ sudo apt-get update
$ sudo apt-get install docker-ce
To simplify the installation process in a test or development environment, Docker provides the installation script for automatic installation.
Raspberry Pi OS supports this script. You can set the --mirror
option to use the sources that are deployed in mainland China.
Note: To install the test version of Docker, get the script from <test.docker.com>.
# $ curl -fsSL test.docker.com -o get-docker.sh
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
# $ sudo sh get-docker.sh --mirror AzureChinaCloud
The preceding scripting code helps you automatically complete all preparations and install the stable version of Docker on Raspberry Pi OS.
Use systemctl
to start the Docker service:
$ sudo systemctl enable docker
$ sudo systemctl start docker
By default, the docker
command uses a Unix socket to communicate with the Docker engine. Only the root
user and users in the docker
group can access the Unix socket of the Docker engine.
For security purposes, the root
user is not used on Linux. Therefore, we recommend that you add users who need to use docker
to the docker
user group.
Create a docker
user group.
$ sudo groupadd docker
Add the current user to the docker
group.
$ sudo usermod -aG docker $USER
Exit the current terminal and log in again. Then, run the following code block to test whether Docker is installed as expected.
$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
4ee5c797bcd7: Pull complete
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
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.
(arm32v7)
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/
If the preceding information is output, it indicates that the installation is successful.
Note: The Arm platform does not support x86 images. To check the images that are supported by Raspberry Pi OS, see arm32v7 or arm64v8.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback