嵌入式爱好者

3588 ubtunt22.04 docker安装出现的问题

2024-4-30 15:18| 发布者: 金色田野的灿烂| 查看: 140| 评论: 0

类目: RK3588系列产品  >  Ubuntu     文档编号: 1387

OK3588如何部署docker

注意:docker部署安装尽量参考官方提供的方式来安装,网上用户文章好多已经过时

docker部署安装

参考:在 Ubuntu 上安装 Docker 引擎 |Docker 文档

官方提供了三种安装方式,这里使用第一种通过apt库的方式下载安装,操作方法也来自于官方

1. 网络链接(可参考ubtun22.04的用户使用手册),更新安装库

root@ok3588:~# nmcli con mod 'Wired connection 1' ipv4.method manual ipv4.addresses 172.16.0.163/24 ipv4.gateway 172.16.0.218 ipv4.dns 222.222.222.222 connection.autoconnect yes
root@ok3588:~# nmcli con up 'Wired connection 1' 
root@ok3588:~# apt-get update 
Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease                      
Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]      
Get:3 https://ppa.launchpadcontent.net/jjriek/rockchip/ubuntu jammy InRelease [18.1 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [109 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
Get:6 https://ppa.launchpadcontent.net/liujianfeng1994/panfork-mesa/ubuntu jammy InRelease [18.1 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 DEP-11 Metadata [423 kB]
Get:8 https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-**/ubuntu jammy InRelease [18.1 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports jammy/main DEP-11 48x48 Icons [100.0 kB]
Get:10 https://ppa.launchpadcontent.net/jjriek/rockchip/ubuntu jammy/main arm64 Packages [7,404 B]
Get:11 http://ports.ubuntu.com/ubuntu-ports jammy/main DEP-11 64x64 Icons [148 kB]    
Get:12 http://ports.ubuntu.com/ubuntu-ports jammy/main DEP-11 64x64@2 Icons [15.8 kB]  
Get:13 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 DEP-11 Metadata [3,360 kB]
Get:14 https://ppa.launchpadcontent.net/jjriek/rockchip/ubuntu jammy/main Translation-en [2,720 B]
Get:15 https://ppa.launchpadcontent.net/liujianfeng1994/panfork-mesa/ubuntu jammy/main arm64 Packages [4,972 B]
Get:16 https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-**/ubuntu jammy/main arm64 Packages [35.8 kB]
Get:17 http://ports.ubuntu.com/ubuntu-ports jammy/universe DEP-11 48x48 Icons [3,447 kB]                                    
Get:18 https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-**/ubuntu jammy/main Translation-en [14.6 kB]      
Get:19 http://ports.ubuntu.com/ubuntu-ports jammy/universe DEP-11 64x64 Icons [7,609 kB]                                    
Get:20 http://ports.ubuntu.com/ubuntu-ports jammy/universe DEP-11 64x64@2 Icons [69.3 kB]                                    
Get:21 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse arm64 DEP-11 Metadata [38.8 kB]                                
Get:22 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse DEP-11 48x48 Icons [42.7 kB]                                    
Get:23 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse DEP-11 64x64 Icons [193 kB]                                    
Get:24 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse DEP-11 64x64@2 Icons [214 B]                                    
Get:25 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 Packages [1,391 kB]                                    
Get:26 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main Translation-en [303 kB]                                      
Get:27 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 DEP-11 Metadata [101 kB]                                
Get:28 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main DEP-11 48x48 Icons [36.1 kB]                                  
Get:29 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main DEP-11 64x64 Icons [55.1 kB]                                  
Get:30 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main DEP-11 64x64@2 Icons [29 B]                                  
Get:31 http://ports.ubuntu.com/ubuntu-ports jammy-updates/restricted arm64 Packages [1,366 kB]                              
Get:32 http://ports.ubuntu.com/ubuntu-ports jammy-updates/restricted Translation-en [311 kB]                                
Get:33 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 Packages [1,011 kB]                                
Get:34 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe Translation-en [244 kB]                                  
Get:35 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 DEP-11 Metadata [301 kB]                            
Get:36 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe DEP-11 48x48 Icons [205 kB]                              
Get:37 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe DEP-11 64x64 Icons [311 kB]                              
Get:38 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe DEP-11 64x64@2 Icons [29 B]                              
Get:39 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse arm64 Packages [24.6 kB]                                 Get:40 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse Translation-en [10.4 kB]                                
Get:41 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse arm64 DEP-11 Metadata [212 B]                          
Get:42 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse DEP-11 48x48 Icons [1,867 B]                            
Get:43 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse DEP-11 64x64 Icons [2,497 B]                            
Get:44 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse DEP-11 64x64@2 Icons [29 B]                            
Get:45 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main arm64 Packages [66.8 kB]                                    
Get:46 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main Translation-en [11.0 kB]                                    
Get:47 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main arm64 DEP-11 Metadata [3,504 B]                            
Get:48 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main DEP-11 48x48 Icons [16.1 kB]                                
Get:49 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main DEP-11 64x64 Icons [21.3 kB]                                
Get:50 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main DEP-11 64x64@2 Icons [29 B]                                
Get:51 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe arm64 Packages [25.6 kB]                                
Get:52 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe Translation-en [16.2 kB]                                
Get:53 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe arm64 DEP-11 Metadata [18.6 kB]                        
Get:54 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe DEP-11 48x48 Icons [15.7 kB]                            
Get:55 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe DEP-11 64x64 Icons [25.6 kB]                            
Get:56 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe DEP-11 64x64@2 Icons [29 B]                            
Get:57 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 Packages [1,181 kB]                                    
Get:58 http://ports.ubuntu.com/ubuntu-ports jammy-security/main Translation-en [243 kB]                                      
Get:59 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 DEP-11 Metadata [43.1 kB]                              
Get:60 http://ports.ubuntu.com/ubuntu-ports jammy-security/main DEP-11 48x48 Icons [16.9 kB]                                
Get:61 http://ports.ubuntu.com/ubuntu-ports jammy-security/main DEP-11 64x64 Icons [26.5 kB]                                
Get:62 http://ports.ubuntu.com/ubuntu-ports jammy-security/main DEP-11 64x64@2 Icons [29 B]                                  
Get:63 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted arm64 Packages [1,317 kB]                              
Get:64 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted Translation-en [300 kB]                                
Get:65 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 Packages [792 kB]                                  
Get:66 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe Translation-en [163 kB]                                  
Get:67 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 DEP-11 Metadata [54.8 kB]                          
Get:68 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe DEP-11 48x48 Icons [22.0 kB]                            
Get:69 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe DEP-11 64x64 Icons [34.6 kB]                            
Get:70 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe DEP-11 64x64@2 Icons [29 B]                              
Get:71 http://ports.ubuntu.com/ubuntu-ports jammy-security/multiverse arm64 Packages [20.3 kB]                              
Get:72 http://ports.ubuntu.com/ubuntu-ports jammy-security/multiverse Translation-en [7,588 B]                              
Fetched 26.0 MB in 27s (980 kB/s)                                                                                            
Reading package lists... Done

2. 设置Docker的存储库

# Add Docker's official GPG key:

root@ok3588:~# apt-get install ca-certificates curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
The following packages will be upgraded:
 curl libcurl4
2 upgraded, 0 newly installed, 0 to remove and 301 not upgraded.
Need to get 474 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 curl arm64 7.81.0-1ubuntu1.16 [190 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 libcurl4 arm64 7.81.0-1ubuntu1.16 [284 kB]
Fetched 474 kB in 5s (94.1 kB/s)  
(Reading database ... 137536 files and directories currently installed.)
Preparing to unpack .../curl_7.81.0-1ubuntu1.16_arm64.deb ...
Unpacking curl (7.81.0-1ubuntu1.16) over (7.81.0-1ubuntu1.13) ...
Preparing to unpack .../libcurl4_7.81.0-1ubuntu1.16_arm64.deb ...
Unpacking libcurl4:arm64 (7.81.0-1ubuntu1.16) over (7.81.0-1ubuntu1.13) ...
Setting up libcurl4:arm64 (7.81.0-1ubuntu1.16) ...
Setting up curl (7.81.0-1ubuntu1.16) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
root@ok3588:~# install -m 0755 -d /etc/apt/keyrings
root@ok3588:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
root@ok3588:~# chmod a+r /etc/apt/keyrings/docker.asc
root@ok3588:~# echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
root@ok3588:~# apt-get update
Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease                      
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease                              
Get:3 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]                        
Get:4 https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages [30.5 kB]
Hit:5 https://ppa.launchpadcontent.net/jjriek/rockchip/ubuntu jammy InRelease  
Hit:6 https://ppa.launchpadcontent.net/liujianfeng1994/panfork-mesa/ubuntu jammy InRelease
Hit:7 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:8 https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-**/ubuntu jammy InRelease
Hit:9 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Fetched 79.4 kB in 3s (23.7 kB/s)
Reading package lists... Done

3. 安装 Docker 包

root@ok3588:~# apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
docker-ce-rootless-extras libslirp0 slirp4netns
Suggested packages:
cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libslirp0 slirp4netns
0 upgraded, 8 newly installed, 0 to remove and 301 not upgraded.
Need to get 96.5 MB of archives.
After this operation, 373 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 libslirp0 arm64 4.6.1-1build1 [60.8 kB]
Get:2 https://download.docker.com/linux/ubuntu jammy/stable arm64 containerd.io arm64 1.6.31-1 [21.5 MB]
Get:3 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 slirp4netns arm64 1.0.1-2 [27.0 kB]
Get:4 https://download.docker.com/linux/ubuntu jammy/stable arm64 docker-buildx-plugin arm64 0.14.0-1~ubuntu.22.04~jammy [27.2 MB]                                                                  
Get:5 https://download.docker.com/linux/ubuntu jammy/stable arm64 docker-ce-cli arm64 5:26.1.0-1~ubuntu.22.04~jammy [13.2 MB]                                                                      
Get:6 https://download.docker.com/linux/ubuntu jammy/stable arm64 docker-ce arm64 5:26.1.0-1~ubuntu.22.04~jammy [15.4 MB]                                                                          
Get:7 https://download.docker.com/linux/ubuntu jammy/stable arm64 docker-ce-rootless-extras arm64 5:26.1.0-1~ubuntu.22.04~jammy [8,402 kB]                                                          
Get:8 https://download.docker.com/linux/ubuntu jammy/stable arm64 docker-compose-plugin arm64 2.26.1-1~ubuntu.22.04~jammy [10.7 MB]                                                                
Fetched 96.5 MB in 28s (3,388 kB/s)                                                                                                                                                                
Selecting previously unselected package containerd.io.
(Reading database ... 137536 files and directories currently installed.)
Preparing to unpack .../0-containerd.io_1.6.31-1_arm64.deb ...
Unpacking containerd.io (1.6.31-1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../1-docker-buildx-plugin_0.14.0-1~ubuntu.22.04~jammy_arm64.deb ...
Unpacking docker-buildx-plugin (0.14.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../2-docker-ce-cli_5%3a26.1.0-1~ubuntu.22.04~jammy_arm64.deb ...
Unpacking docker-ce-cli (5:26.1.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../3-docker-ce_5%3a26.1.0-1~ubuntu.22.04~jammy_arm64.deb ...
Unpacking docker-ce (5:26.1.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../4-docker-ce-rootless-extras_5%3a26.1.0-1~ubuntu.22.04~jammy_arm64.deb ...
Unpacking docker-ce-rootless-extras (5:26.1.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../5-docker-compose-plugin_2.26.1-1~ubuntu.22.04~jammy_arm64.deb ...
Unpacking docker-compose-plugin (2.26.1-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package libslirp0:arm64.
Preparing to unpack .../6-libslirp0_4.6.1-1build1_arm64.deb ...
Unpacking libslirp0:arm64 (4.6.1-1build1) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../7-slirp4netns_1.0.1-2_arm64.deb ...
Unpacking slirp4netns (1.0.1-2) ...
Setting up docker-buildx-plugin (0.14.0-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (1.6.31-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.26.1-1~ubuntu.22.04~jammy) ...
Setting up docker-ce-cli (5:26.1.0-1~ubuntu.22.04~jammy) ...
Setting up libslirp0:arm64 (4.6.1-1build1) ...
Setting up docker-ce-rootless-extras (5:26.1.0-1~ubuntu.22.04~jammy) ...
Setting up slirp4netns (1.0.1-2) ...
Setting up docker-ce (5:26.1.0-1~ubuntu.22.04~jammy) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...

通过查看systemctl satus docker查看docker服务是没有启动的

原因:Docker通常使用iptables-legacy版本来管理防火墙规则,因为它与Docker的网络功能更兼容。当前系统的iptables的版本为iptables-nft,与Docker使用的iptables规则不兼容或存在一些不同之处。

root@ok3588:~# systemctl status docker
× docker.service - Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Mon 2024-04-29 15:12:43 CST; 1min 33s ago
TriggeredBy: × docker.socket
      Docs: https://docs.docker.com
  Process: 4772 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
  Main PID: 4772 (code=exited, status=1/FAILURE)
      CPU: 204ms

Apr 29 15:12:41 ok3588 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Apr 29 15:12:41 ok3588 systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 29 15:12:41 ok3588 systemd[1]: Failed to start Docker Application Container Engine.
Apr 29 15:12:43 ok3588 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Apr 29 15:12:43 ok3588 systemd[1]: Stopped Docker Application Container Engine.
Apr 29 15:12:43 ok3588 systemd[1]: docker.service: Start request repeated too quickly.
Apr 29 15:12:43 ok3588 systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 29 15:12:43 ok3588 systemd[1]: Failed to start Docker Application Container Engine.

4. 切换iptables-legacy版本来管理防火墙规则

root@ok3588:~# update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in manual mode

5. 重启docker服务

root@ok3588:/run/media# systemctl restart docker
root@ok3588:/run/media# systemctl status docker
● docker.service - Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2024-04-29 16:01:52 CST; 1s ago
TriggeredBy: ● docker.socket
      Docs: https://docs.docker.com
  Main PID: 2789 (dockerd)
      CPU: 362ms
    CGroup: /system.slice/docker.service
            └─2789 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.793592591Z" level=warning msg="WARNING: No io.weight support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.793841086Z" level=warning msg="WARNING: No io.weight (per device) support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.795967584Z" level=warning msg="WARNING: No io.max (rbps) support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.797014062Z" level=warning msg="WARNING: No io.max (wbps) support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.797250015Z" level=warning msg="WARNING: No io.max (riops) support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.797479844Z" level=warning msg="WARNING: No io.max (wiops) support"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.797751088Z" level=info msg="Docker daemon" commit=c8af8eb containerd-snapshotter=false storage-driver=overlay2 version=26.1.0
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.798072790Z" level=info msg="Daemon has completed initialization"
Apr 29 16:01:52 ok3588 dockerd[2789]: time="2024-04-29T08:01:52.856171004Z" level=info msg="API listen on /run/docker.sock"
Apr 29 16:01:52 ok3588 systemd[1]: Started Docker Application Container Engine.

扩展:

journalctl -xr  -u docker.service   //查看docker服务相关日志


已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-11-22 10:19

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部