在 chroot 中运行 docker

在 chroot 中运行 docker

我正在尝试为 RaspberryPi 构建一个发行版,它附带运行 docker 的 aarch64 chroot。

为了实现这一点,我需要在 chroot 中运行 docker。我以 rasbian 为基础,它仅在 arm32v7 中分发。

我已经dockerd使用以下命令在 chroot 中启动:

#!/usr/bin/env bash
/usr/bin/cgroupfs-mount
/usr/bin/dockerd -H unix://

但是,当我尝试调出一个容器时,我得到:

docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
256ab8fe8778: Pull complete 
Digest: sha256:d1668a9a1f5b42ed3f46b70b9cb7c88fd8bdc8a2d73509bb0041cf436018fbf5
Status: Downloaded newer image for hello-world:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:109: jailing process inside rootfs caused \\\"pivot_root invalid argument\\\"\"": unknown.
ERRO[0005] error waiting for container: context canceled 

任何容器都会发生这种情况。

Docker 服务已启动,docker build 出现类似问题;

Running in 74fe7f0514d0
OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:109: jailing process inside rootfs caused \\\"pivot_root invalid argument\\\"\"": unknown

我假设发生这种情况是因为我处于 chroot 中。我有以下挂载绑定:

# fstab: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/proc           /proc           none    rw,bind         0       0
/sys            /sys            none    rw,bind         0       0
/dev            /dev            none    rw,bind         0       0
/dev/pts        /dev/pts        none    rw,bind         0       0
/home           /home           none    rw,bind         0       0
/tmp            /tmp            none    rw,bind         0       0

# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot.  However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
/run           /run            none    rw,bind         0       0
/run/lock      /run/lock       none    rw,bind         0       0
/dev/shm       /dev/shm        none    rw,bind         0       0
/run/shm       /run/shm        none    rw,bind         0       0

我所写内容的来源也可以在这里找到: https://github.com/guysoft/Raspbian64

谢谢,

相关内容