树莓派安装Docker | Eddie'Blog
树莓派安装Docker

树莓派安装Docker

eddie 607 2020-05-02

安装Docker

Docker CE 镜像源站

脚本自动安装

  1. 执行脚本:(服务器在国外,小乌龟跑路)
curl -sSL https://get.docker.com | sh
  1. 执行脚本,指定阿里镜像
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

加入pi组,简化sudo

sudo usermod -aG docker pi

开机启动

sudo systemctl enable docker
sudo systemctl start docker

查看版本信息

pi@raspberrypi:/opt $ sudo docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:35:24 2020
 OS/Arch:           linux/arm
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:22 2020
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

镜像加速器

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://08szpt4p.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

服务编排

1. 安装
sudo apt install docker-compose

2.查看版本
pi@raspberrypi:~ $ sudo docker-compose version
docker-compose version 1.21.0, build unknown
docker-py version: 3.4.1
CPython version: 3.7.3
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

TIPS

树莓派是arm架构,arm平台不能使用x86镜像,并且安装服务编排时候不能使用官方,也是不支持arm架构