第四步 电视盒子LXC套娃Docker - cooip-jm/About-openwrt GitHub Wiki
既然玩LXC了,那么我们尽量让宿主机少些污染,把docker扔进LXC里跑
这回轮到Ububtu来担纲
(alpine / debian 都可以,这只是为了“演出效果”)
都是演的
lxc-create --name Docker --template download -- --dist ubuntu --release jammy --arch arm64 --server mirrors.bfsu.edu.cn/lxc-images
同样的套路
注意
演示里使用的是vmbr0,使用的是宿主的网桥,不是lxcbr0
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64
# Container specific configuration
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
lxc.apparmor.raw = mount fstype=fuse,
# fuse-overlayfs package installed both on host and inside container
lxc.mount.entry = /dev/fuse dev/fuse none bind,create=file 0 0
lxc.mount.auto = sys:mixed
lxc.rootfs.path = dir:/var/lib/lxc/Docker/rootfs
lxc.uts.name = Docker
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = vmbr0
lxc.net.0.flags = up
提示
纯LXC 在使用docker的配置文件中添加
fuse-overlayfs package installed both on host and inside container
lxc.mount.entry = /dev/fuse dev/fuse none bind,create=file 0 0
使用PVE的在配置文件添加
features: fuse=1,nesting=1
然后根据自己使用的rootfs,在其中安装和配置fuse-overlayfs
如果不能使用包管理器安装的可以使用下面仓库中的二进制文件
https://github.com/containers/fuse-overlayfs/releases
存于该位置 并赋权 755
/usr/local/bin/fuse-overlayfs
配置 Docker 的存储层驱动更换为 fuse-overlayfs
nano /etc/docker/daemon.json
{"storage-driver": "fuse-overlayfs"}
启动、换源、安装Docker 服务
ARM ubuntu源使用的是ports
https://mirrors.bfsu.edu.cn/help/ubuntu-ports/
lxc-start Docker
lxc-attach Docker
##进入后
vi /etc/apt/sources.list
安装一些基础工具
apt update && apt upgrade -y && apt install curl nano wget git fuse-overlayfs apt-transport-https ca-certificates apt-utils software-properties-common gnupg lsb-release -y
偷懒的一键脚本
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
或者
curl -fsSL https://get.docker.com | bash -s docker --mirror AzureChinaCloud
安装个面板
docker run -d --restart=always --name="portainer" -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock 6053537/portainer-ce