创建 LXC

创建容器时取消勾选无特权容器!

创建容器时取消勾选无特权容器!

创建容器时取消勾选无特权容器!

创建完毕后在 PVE Host 内执行

cat >> /etc/pve/lxc/[LXC_ID].conf << EOL
lxc.apparmor.profile: unconfined
EOL

换源

sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list

更新

apt update && apt upgrade -y

魔法

HTTP_PROXY=http://192.168.1.5:7890/
HTTPS_PROXY=http://192.168.1.5:7890/
NO_PROXY=localhost,192.168.1.5,.example.com

安装 Docker

安装 Docker

apt install curl -y
curl -sSL https://get.daocloud.io/docker | sh

设置镜像源和容器网段

编辑daemon.json文件

nano /etc/docker/daemon.json

填入

{
"registry-mirrors": [
        "https://docker.mirrors.ustc.edu.cn",
        "https://hub-mirror.c.163.com"
    ],
    "bip": "192.168.10.1/24"
}

重启 Docker 生效

systemctl restart docker

安装 Portainer CE

docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /volume1/docker/portainer:/data portainer/portainer-ce:latest

参考文献

https://ihnic.com/index.php/archives/12/

https://docs.portainer.io/start/install-ce/server/docker/linux

https://mirrors.ustc.edu.cn/help/debian.html