docker virtualbox 无法启动

docker over virtualbox cannot start

我有一个 docker 文件,它创建了一个 运行 在我的 Ubuntu 18.04.

上的有效图像

为了与其他机器兼容,我尝试在 Virtual Box Ubuntu 机器中 运行 docker(并避免可能发生的任何配置错误)。

我的docker运行命令行:

docker run -id --net=host --rm --privileged --gpus=all --env="NVIDIA_DRIVER_CAPABILITIES=all" --env="DISPLAY" -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix:rw -v /run/user/1000/gdm/Xauthority:/root/.Xauthority --env="QT_X11_NO_MITSHM=1" --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /home/git/:/git --name nirge_sim nirge-sim:1.0

基础docker文件:

FROM gazebo:gzserver9-bionic

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics

# install Utilities
RUN apt-get update -y && apt-get install -y apt-utils curl ca-certificates wget \
    && rm -rf /var/lib/apt/lists/*

# install gazebo packages
RUN apt-get update -y && apt-get install -y --allow-unauthenticated --no-install-recommends \
    libgazebo9-dev \
    && rm -rf /var/lib/apt/lists/*

# install ros packages
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -

RUN apt-get update && apt-get install -y --allow-unauthenticated \
    ros-melodic-desktop-full \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y --allow-unauthenticated --no-install-recommends \
    ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control \
    ros-melodic-gazebo-plugins ros-melodic-gazebo-ros  ros-melodic-gazebo-ros\
    ros-melodic-simulators \
    && rm -rf /var/lib/apt/lists/*

# final config for ros
RUN echo 'source /opt/ros/melodic/setup.bash' >> /root/.bashrc
RUN echo 'export LIBGL_ALWAYS_INDIRECT=1' >>  /root/.bashrc
CMD ["bash"]

所以这可以在我的主机上运行,​​但不能通过虚拟框在我的托管主机上运行。 错误是:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: nvml error: driver not loaded: unknown.

非常感谢有关此问题的任何建议。

其中一个依赖项 (Gazebo) 似乎需要一个专用 GPU,它没有作为 VirtualBox 的一部分进行模拟。

Nvidia cards tend to work well in Ubuntu 来自 original site