第二步:树莓派docker安装

官网三种安装方式,故不再赘述

大部分内容可参考官网链接https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1 

硬件  树莓派3B + Respbian

OS要求

要安装Docker CE,您需要这些Debian或Raspbian版本之一的64位版本:

         Buster 10

        Stretch 9 (stable) / Raspbian Stretch

Docker CE在x86_64(或amd64armhfarm64架构上受支持。

 

方法1:脚本安装

$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

安装完成有如下打印:

If you would like to use Docker as a non-root user, you should now consider    

 adding your user to the "docker" group with something like:     

sudo usermod -aG docker runoob Remember that you will have to log out and back in for this to take effect!

 

如果您想将Docker用作非root用户,您现在应该考虑将您的用户添加到“docker”组,例如:

1

sudo usermod -aG docker your-user

方法2:源安装(本次测试使用的安装方式)

sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 lsb-release software-properties-common

树莓派docker安装步骤
第一步:移除旧版本docker(可选),更新包索引,安装https相关包

第二步:添加docker官方GPG秘钥,设置仓库

如何更改软件源
中科大源

sudo add-apt-repository "deb [arch=armhf] https://mirrors.ustc.edu.cn/docker-ce/linux/raspbian/gpg stretch stable"
echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/raspbian stretch stable" | sudo tee /etc/apt/sources.list.d/docker.list

清华源

curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/raspbian/gpg | sudo apt-key add -
echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/raspbian stretch stable" | sudo tee /etc/apt/sources.list.d/docker.list

官方源

curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
echo deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable | sudo tee /etc/apt/sources.list.d/docker.list

第三步:安装最新版本docker
 

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

 

测试:

1.安装完成后默认是启动的,若未启动则执行启动命令

sudo service docker start

2.Docker默认在root用户下运行,如果用非root用户操作docker,则需要将用户名添加到docker组

sudo usermod -aG docker your-user

3.执行经典的hello-world

sudo docker run hello-world

4.出现如如下打印则说明docker已经安装完成并正常运行

pi@raspberrypi:~ $ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1eda109e4da: Pull complete 
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
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/

--------------------- 
作者:cnwyan729 
来源:CSDN 
原文:https://blog.csdn.net/cnwyan729/article/details/89086153 
版权声明:本文为博主原创文章,转载请附上博文链接!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章