树莓派2下如何安装docker

2023-04-09 10:33:00 docker 安装 树莓派

树莓派2下安装docker的方法如下:

1.安装依赖包:

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

2.添加Docker的官方GPG密钥:

curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -

3.使用下面的命令来设置稳定的软件源:

echo "deb [arch=armhf] https://download.docker.com/linux/raspbian stretch edge" | sudo tee /etc/apt/sources.list.d/docker.list

4.更新并安装Docker CE

sudo apt-get update && sudo apt-get install docker-ce

5.启动Docker

sudo systemctl start docker

6.使用下面的命令来验证是否安装成功

sudo docker run hello-world

如果出现下面的输出,则表明安装成功

Hello from Docker!

This message shows that your installation appears to be working correctly.

7.使用命令来将当前用户加入到docker用户组中

sudo usermod -aG docker pi

8.重新登录使配置生效

9.使用命令来验证是否配置成功

docker run hello-world

如果出现下面的输出,则表明配置成功

Hello from Docker!

This message shows that your installation appears to be working correctly.

相关文章