2024年11月24日星期日 下午12:48:34

Install Docker on Raspberry Pi (使用官方安装脚本自动安装)

1 年 前
#20934 引用
Install Docker  on Raspberry Pi



Install Docker Engine on Raspbian

https://docs.docker.com/engine/install/raspbian/

To install Docker Engine, you need the 64-bit version or 32-bit version of one of these Raspbian versions:


OS requirements



Raspbian Bookworm 12 (testing)
Raspbian Bullseye 11 (stable)
Raspbian Buster 10 (oldstable)


Install Docker on Raspberry Pi OS

This installation instruction refers to the 32-bit (armhf) version of Raspberry Pi OS.
https://docs.docker.com/engine/install/raspberry-pi-os/

This installation instruction refers to the 64-bit (armhf) version of Raspberry Pi OS.

https://docs.docker.com/engine/install/debian/

source:https://docs.docker.com/engine/install/raspberry-pi-os/

我之前折腾1天才装的docker
0
1 年 前
#20935 引用
Install Docker  on Raspberry Pi

https://docs.docker.com/engine/install/raspbian/

For the 32-bit version of Raspbian follow the instructions for Debian.

https://docs.docker.com/engine/install/raspbian/


For the 64-bit version of Raspbian follow the instructions for Debian.


Install Docker Engine on Debian
source:https://docs.docker.com/engine/install/debian/

Install Docker Engine on Debian


确认操作系统版本


#查看系统内核 uname -r
#查看系统详细信息 cat /etc/os-release




Install Docker  on debian
https://docs.docker.com/desktop/install/debian/
0
1 年 前
#20936 引用
step 1.更新操作系统

Before you start, make sure your system is fully updated, all packages in this guide are installed with apt

sudo apt-get update
sudo apt-get upgrade


运行sudo apt-get upgrade后,会更新很多包。大多数安装不成功的,就是这个原因。更新后,后面的安装很顺利





Debian Bookworm 12 (stable)
Debian Bullseye 11 (oldstable)


Docker Engine for Debian is compatible with x86_64 (or amd64), armhf, and arm64 architectures.

https://docs.docker.com/engine/install/debian/#os-requirements


root@raspberrypi:~# docker version



Client: Docker Engine - Community
Version:           24.0.2
API version:       1.43
Go version:        go1.20.4
Git commit:        cb74dfc
Built:             Thu May 25 21:52:30 2023
OS/Arch:           linux/arm
Context:           default

Server: Docker Engine - Community
Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:30 2023
  OS/Arch:          linux/arm
  Experimental:     false
containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

0
1 年 前
#20937 引用
step 2:查看操作系统版本和操作系统位数

查看树莓派 | Linux 系统是多少位

这个关系到安装官方的哪个安装教程


OS requirements
To install Docker Engine, you need the 64-bit version of one of these Debian versions:

lsb_release -a


root@raspberrypi:~# lsb_release -a
No LSB modules are available.
Distributor ID:  Raspbian
Description:  Raspbian GNU/Linux 11 (bullseye)
Release:  11
Codename:  bullseye




root@raspberrypi:~# getconf LONG_BIT
32


如果结果返回 32,说明是 32 位系统;

如果结果返回 64,说明是 64 位系统


https://www.matterxiaomi.com/boards/topic/57/installing-home-assistant-core-202230-on-raspberry-pi-3b-step-by-step/page/1#1205


$ sudo systemctl enable docker
$ sudo systemctl start docker
sudo systemctl status docker
sudo systemctl restart docker.service

#stop the Docker Engine service:
sudo systemctl stop docker docker.socket containerd

sudo systemctl disable docker docker.socket containerd



https://docs.docker.com/desktop/faqs/linuxfaqs/#what-is-the-difference-between-docker-desktop-for-linux-and-docker-engine
0
1 年 前
#20938 引用
step 3. install

32 位的

or

https://docs.docker.com/engine/install/raspbian/

64位的

https://docs.docker.com/engine/install/debian/

Before you can install Docker Engine, you must first make sure that any conflicting packages are uninstalled.

Run the following command to uninstall all conflicting packages:
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done


Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
[url]sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras[/url]


Uninstall Docker Engine

https://docs.docker.com/engine/install/debian/#uninstall-docker-engine

sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras




sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd




other



root@vultr:~# docker version

Command 'docker' not found, but can be installed with:

snap install docker     # version 20.10.24, or
apt  install docker.io

See 'snap info docker' for additional versions.


0
1 年 前
#20939 引用
step 5. install 确定安装方式

You can install Docker Engine in four ways。

Install using the apt repository
Install from a package


共有4种


0
1 年 前
#20940 引用
step 3.Installation methods -  Install using the convenience script


根据官网建议,我使用,docker官方提供的便捷脚本来一键安装,先下载再执行就OK



curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

sudo usermod -aG docker $USER

0
1 年 前
#20941 引用
Output



root@raspberrypi:~# curl -fsSL https://get.docker.com -o get-docker.sh
root@raspberrypi:~# sudo sh get-docker.sh
# Executing docker install script, commit: c2de0811708b6d9015ed1a2c80f02c9b70c8ce7b
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.

You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c install -m 0755 -d /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
+ sh -c chmod a+r /etc/apt/keyrings/docker.gpg
+ sh -c echo "deb [arch=armhf signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian bullseye stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
Version:           24.0.5
API version:       1.43
Go version:        go1.20.6
Git commit:        ced0996
Built:             Fri Jul 21 20:35:37 2023
OS/Arch:           linux/arm
Context:           default

Server: Docker Engine - Community
Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:37 2023
  OS/Arch:          linux/arm
  Experimental:     false
containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================



0
1 年 前
#22161 引用
Step 4: Test the Docker Installation on Raspberry Pi

docker run hello-world



0
1 年 前
#22162 引用
docker version


output

@raspberrypi:~# docker version
Client: Docker Engine - Community
Version:           26.1.3
API version:       1.45
Go version:        go1.21.10
Git commit:        b72abbb
Built:             Thu May 16 08:33:25 2024
OS/Arch:           linux/arm64
Context:           default

Server: Docker Engine - Community
Engine:
  Version:          26.1.3
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.10
  Git commit:       8e96db1
  Built:            Thu May 16 08:33:25 2024
  OS/Arch:          linux/arm64
  Experimental:     false
containerd:
  Version:          1.6.32
  GitCommit:        8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
0