This Docker container includes VirtualBox, allowing you to run VirtualBox inside a container using Docker.
Before running this container, ensure you have Docker installed on your system. You also need to ensure that VirtualBox is installed on the host system and the necessary kernel modules (vboxdrv) are loaded.
To build this container, use the following Docker command:
docker build -t vboxdocker .You can also get the pre-built image from Docker Hub:
docker pull celyrin/vboxdocker:latestTo run this container, use the following Docker command:
docker run -it --rm --privileged \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
--tmpfs /run \
--tmpfs /run/lock \
-v /dev/vboxdrv:/dev/vboxdrv \
--net=host \
vboxdocker-it: Runs Docker in interactive mode with a tty.--rm: Automatically removes the container when it stops.--privileged: Gives extended privileges to this container.-v /sys/fs/cgroup:/sys/fs/cgroup:ro: Mounts the cgroup filesystem from the host to the container in read-only mode.--tmpfs /runand--tmpfs /run/lock: Creates temporary file storage areas that are necessary for running services within the container.-v /dev/vboxdrv:/dev/vboxdrv: Mounts the VirtualBox driver from the host to allow VirtualBox to interact with the kernel modules.--net=host: Uses the host's networking stack inside the container.
- Running VirtualBox inside a Docker container requires privileged access to the host's system resources, which can pose security risks. Ensure you trust the software and understand the security implications before proceeding.
- Ensure that the VirtualBox kernel modules are properly installed and loaded on your host system.
For any issues or further assistance, please refer to the official VirtualBox documentation or open an issue in this repository.