在麒麟v11桌面版上安装docker

信创,你懂的

第一坑安装被拦截

使用apt 安装几乎任意程序时,都报错。如 apt install vim

1
2
3
4
5
......
debconf: 返回前端界面:Readline
** 当前模式禁止执行(unpack)操作**
dpkg: 错误: 执行钩子 /usr/bin/ostree-pkgs-guard 出错,退出状态为 256
E: Sub-process /usr/bin/dpkg returned an error code (2)

原因及解决

大概就是内置的一个安全策略把安装的这个操作拒绝了。OSTree

需要打开维护模式才能安装程序

https://www.cnblogs.com/qingzhen/p/19679082

参考以上链接打开维护模式即可

docker

docker官方不提供这个个版本的安装方式

但由于麒麟系统是基于ubuntu开发的,所以可以使用ubuntu/debian的deb包,甚至连仓库都可以使用

我习惯使用debian,就用debian的仓库,参考官方链接

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

一,卸载老版docker.io(可省略)

因为默认情况下,没有安装这些

1
sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc | cut -f1)

配置仓库

注意这一步和官网的不一样,就在Suites: bookworm那一行。

即本脚本是指定使用debian bookworm版本的docker包,而官方脚本则会根据debian的版本不同输出不同的版本bullseye/bookworm/trixie。如果直接使用官方脚本,则会输出kylin

重要,请使用本脚本,别使用官方的脚本

重要,请使用本脚本,别使用官方的脚本

重要,请使用本脚本,别使用官方的脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: bookworm
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

安装

1
2
3
apt update

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

使用

1
docker run --rm hello-world

如果前面执行得没错,又一个坑来了。。。


docker: Error response from daemon: failed to mount /tmp/containerd-mount1855086                                                                                                                              828: mount source: "overlay", target: "/tmp/containerd-mount1855086828", fstype:                                                                                                                               overlay, flags: 0, data: "workdir=/var/lib/containerd/io.containerd.snapshotter                                                                                                                              .v1.overlayfs/snapshots/9/work,upperdir=/var/lib/containerd/io.containerd.snapsh                                                                                                                              otter.v1.overlayfs/snapshots/9/fs,lowerdir=/var/lib/containerd/io.containerd.sna                                                                                                                              pshotter.v1.overlayfs/snapshots/1/fs,index=off", err: invalid argument



Run 'docker run --help' for more information

请看下一篇。。。

0%