Closed Ahaxzh closed 1 year ago
你可以尝试通过编辑文件 /etc/init.d/dockerd, 让dockerd加载你自已定义的配置文件: /usr/bin/dockerd --config-file="${DOCKERD_CONF}"
所以依旧无法解决么。我现在是插了一张256G的SD卡在用了,但是早知如此不如买R4S了。
可能是因为我们的系统默认已经使用了overlayfs, 所以docker无法开启overlay2, 试了下可以用以下方法解决:
1) 先禁用系统的 overlayfs, 方法是刷完系统后, 用 fdisk命令删除掉最好一个userdata分区 (默认大小为100M左右),
SD卡的系统, 在电脑上直接操作SD卡即可: sudo fdisk /dev/sdX 命令(输入 m 获取帮助): d 分区号 (1-9, 默认 9): 9 命令(输入 m 获取帮助): w
eMMC的系统, 则在使用eMMC刷机助手刷完系统后, 先不重启, 进入终端, 删除eMMC里的最后一个分区: fdisk /dev/mmcblk2 Command (m for help): d Partition number (1-9, default 9): 9 Partition 9 has been deleted. Command (m for help): w
拨出SD卡, 重新上电, 从eMMC启动系统;
2) 启动系统后, 使用df查看/分区, 显示为/dev/mmcblk2p8说明已经没有在使用overlayfs: root@FriendlyWrt:~# df Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 512 0 512 0% /dev tmpfs 785668 156 785512 1% /run /dev/mmcblk2p8 30039536 552428 27962408 2% / tmpfs 3928332 21856 3906476 1% /tmp cgroup 3928332 0 3928332 0% /sys/fs/cgroup
3) docker配置文件的修改: cp /tmp/dockerd/daemon.json /etc/docker/ 编辑 /etc/docker/daemon.json, 内容如下 { "storage-driver": "overlay2", "data-root": "\/opt\/docker\/", "log-level": "warn", "iptables": true } 编辑 /etc/config/dockerd, 去掉 option alt_config_file '/etc/docker/daemon.json' 前面的注释 重启
4) 重启后用docker info查看, 已经是overlay2了:
root@FriendlyWrt:~# docker info Client: Context: default Debug Mode: false
Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.18 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: false userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 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 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: runc version: init version: de40ad0 Kernel Version: 5.10.110 Operating System: OpenWrt 22.03.2 OSType: linux Architecture: aarch64 CPUs: 8 Total Memory: 7.493GiB Name: FriendlyWrt ID: BMXH:2XGN:O233:YAL6:TPST:OVDV:YUZR:V6EM:UIBB:S5LB:DOJC:SOS3 Docker Root Dir: /opt/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
root@FriendlyWrt:~#
感谢,我试试。建议集成到官方固件本身。
RT. 目前使用的是 R5S-FriendlyWrt-22.03-docker.img.gz 11月1号自动构建的系统。
Docker info 如下:
问题如下: 1、Docker 默认 Storage Driver 用的是 vfs 如何修改成overlay2,目前vfs并不是一个适合生产使用的驱动,会非常的占用空间。
2、Docker这个版本默认用的iptables,但是22.03默认用的 nftables,现在系统中会提示混用有问题。
查看系统进程可以看到Docker调用的配置文件地址在/tmp/docker/daemon.json ,我没有尝试修改该文件,因为这个位置看起来会觉得是根据/etc/config/dockerd 临时生成的。