docker over virtualbox 无法启动

标签 docker ubuntu virtualbox

我有一个 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

关于docker over virtualbox 无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68210716/

相关文章:

ubuntu - 在 VMware Ubuntu 22.04 guest 虚拟机上通过 Packer 和 Terraform 运行 cloud-init 两次

linux - flutter run 无法访问我的辅助硬盘的文件

windows - SSH 到 Windows 中的 Vagrant box?

c++ - 在 Linux 上启用 OpenMPI

在 Linux 主机上运行 XP 客户机的 Oracle Virtual Box 上的 C++ 编译器

ubuntu - npm 错误! errno ECONNREFUSED 当我执行 : npm install

php - Dockerized Laravel 应用程序,总是 404 Assets

docker - 有没有办法在 yaml 中定义您的 Compose Swarm 所在的命名空间?

docker - 为什么 Kafka 会警告 "partitions have leader brokers without a matching listener"?

shell - 如何将Jenkins凭证传递给Dockerfile/Shell?