第二步:樹莓派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 
版權聲明:本文爲博主原創文章,轉載請附上博文鏈接!

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