Skip to content

How to bind mount the chroot directory onto the chroot / #149

Open
@jason51553262

Description

Hi,

Is there a way to bind mount the chroot directory onto / ?

I need to get docker pull working in the chroot, and in order for docker pull to work properly I need to bind mount the chroot directory onto the chroot /

Ie. mount -o bind chroot-ubuntu chroot-ubuntu/

Here's the full working chroot example:

mkdir chroot-ubuntu
debootstrap --variant=buildd jammy chroot-ubuntu
mount -o bind chroot-ubuntu chroot-ubuntu/
mount --rbind /sys chroot-ubuntu/sys
mount --rbind /dev chroot-ubuntu/dev
mount -t proc /proc chroot-ubuntu/proc
chroot chroot-ubuntu /bin/bash
apt update
apt install -y iptables curl
curl -fsSL https://get.docker.com | sh
/usr/bin/dockerd --iptables=False &
sleep 2
docker pull alpine

Here is the thread where the chroot bind mount was suggested to fix the docker pull issue.
moby/moby#34817

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions