##安装Docker
sudo apt install curl
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
验证docker 安装是否成功
sudo docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.10.4
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.17.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 23.0.2
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
runc version: v1.1.5-0-gf19387a
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.10.110
Operating System: Ubuntu 22.04.2 LTS
OSType: linux
Architecture: aarch64
CPUs: 8
Total Memory: 7.489GiB
Name: NanoPi-R6S
ID: 4357134e-d836-48a2-acf5-69dafd4617f9
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
编写daemon.json,用于加速器
sudo touch /etc/docker/daemon.json
sudo chmod 777 /etc/docker/daemon.json
vim /etc/docker/daemon.json
{
"registry-mirrors":
["https://8xpk5wnt.mirror.aliyuncs.com"]
}
用命令修改daemon.json的仓库地址
pi@NanoPi-R6S:~$ curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
[sudo] password for pi:
{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"]
}
Success.
You need to restart docker to take effect: sudo systemctl restart docker.service
pi@NanoPi-R6S:~$ systemctl restart docker
启动dockers
sudo systemctl daemon-reload
sudo systemctl enable docker
sudo systemctl restart docker
ps -ef|grep dockerd
docker ps
docker images
docker version
docker启动报错:Job for docker. service failed because the control process exited with error code
mv etc/docker/daemon.json etc/docker/daemon.conf
systemctl restart docker
查看到下列信息,表明docker正确启动了
Client: Docker Engine - Community
Version: 23.0.2
API version: 1.42
Go version: go1.19.7
G