GithubHelp home page GithubHelp logo

gezp / docker-ubuntu-desktop Goto Github PK

View Code? Open in Web Editor NEW
206.0 5.0 45.0 963 KB

Docker Image for Ubuntu Desktop which support HW GPU accelerated GUI apps. you can access the Container with ssh or remote desktop, just like Cloud VM.

License: MIT License

Shell 23.34% Dockerfile 76.66%
virtualgl ubuntu docker nvidia-gpu cuda opengl nomachine remote-desktop

docker-ubuntu-desktop's Introduction

Ubuntu Desktop based on Docker

DockerHub

简体中文

This project provides a docker image which supports ubuntu desktop (xfce4, lightweight, fast and low on system resources), so that you can run virtual ubuntu desktop in container, you can access it by using ssh or remote desktop just like a virtual machine.

Hardware GPU accelerated rendering for 3D GUI application is supported in container, it's based on EGL by using VirtualGL, and doesn't require /tmp/.X11-unix. if you needn't hardware GPU accelerated rendering, you can also run this container on headless host without GPU (for exmaple, Cloud Server), remote desktop and 3d GUI based on software rendering (high cpu usgae) is also supported.

Tip: Hardware GPU accelerated rendering is only verified on ubuntu desktop system host with monitor. i'm not sure if hardware GPU accelerated rendering can work for headless ubuntu server system host.

Features

  • Remote access by ssh and nomachine (remote desktop).
  • OpenGL rendering based on software rasterizer (LLVMpipe) with high CPU usgae. (default)
  • OpenGL rendering based on Nvidia GPU hardware-accelerated.
  • Pre-installed Firefox web browser.
  • pre-installed CUDA toolkit, which is useful for deep learning, such as pytorch, tensorflow.

Tip: it's useful to share public computer resources in labs, you can run a independent computer environment like a virtual machine, but more lightweight, and easier to deploy.

  • fast to deploy multiple independent developing environment on a single computer.
  • easy to share files with host or another container.
  • easy to transfer environment to another new computer (save and load image).

xfce4 desktop:

Docker Image Tags:

Supported Tags (you can find here Github Tag):

  • Tags of base image:18.04, 20.04, 22.04
  • Tags of image with cuda (based on nvidia/cuda):18.04-cu11.0.3, 20.04-cu11.0.3 etc.
  • naming rules is {UBUNTU VERSION}-cu{CUDA VERSION}, you can find supported {CUDA VERSION} in Docker Image <nvidia/cuda>

Supported {CUDA VERSION}:

  • Ubuntu18.04:11.0.3, 11.1.1, 11.2.2
  • Ubuntu20.04:11.0.3, 11.1.0, 11.2.2, 11.3.1, 11.4.3, 11.5.2, 11.6.2, 11.7.1
  • Ubuntu22.04:11.7.1, 11.8.0, 12.0.1, 12.1.1

Preliminary

  • install nvidia driver
  • install docker and nvidia-container-runtime.

Tip: the newer cuda version isn't supported if you use older nvidia driver.

Quickly Start

pull docker image

docker pull gezp/ubuntu-desktop:20.04-cu11.0.3
# use aliyuncs mirror for chinese users (国内用户可使用阿里云仓库)
# docker pull registry.cn-hongkong.aliyuncs.com/gezp/ubuntu-desktop:20.04-cu11.0.3

create conatiner

# create conatiner
docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    --gpus all  \
    --shm-size=1024m \
    -p 10022:22  \
    -p 14000:4000  \
    gezp/ubuntu-desktop:20.04-cu11.0.3
  • the default username and password are both ubuntu.

access conatiner by ssh

ssh ubuntu@host-ip -p 10022
  • it's recommended to use vscode + remote ssh plugin

access conatiner by nomachine client (remote desktop)

Advanced Usage

Custom User Argument

configure USER, PASSWORD, GID, UID when you create conatiner,for example:

docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    --gpus all  \
    -e USER=cat \
    -e PASSWORD=cat123 \
    -e GID=1001 \
    -e UID=1001 \
    --shm-size=1024m \
    -p 10022:22  \
    -p 14000:4000  \
    gezp/ubuntu-desktop:20.04-cu11.0.3

Enable GPU hardware-accelerated rendering

Test VirtualGL

vglrun glxinfo | grep -i "opengl"
  • hardware-accelerated is enable successfully if it's output contain NVIDIA Product Series.

you need add prefix vglrun for command when you run 3D software, for example vglrun gazebo.

Test vulkan

# vulkan info
vulkaninfo | grep -i "GPU"
# vulkan demo
vkcube
  • it's output should contain NVIDIA Product Series if vulkan works well.

CUDA

add shell in .bashrc to update environment variable

export CUDA_HOME=/usr/local/cuda
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
  • for detailed usage, you can refer to nvidia/cuda Docker Image.

Build

for example

git clone https://github.com/gezp/docker-ubuntu-desktop.git
cd docker-ubuntu-desktop
# for 20.04
./docker_build.sh 20.04
# for 20.04-cu11.0  (based on nvidia/cuda)
./docker_build.sh 20.04-cu11.0

Acknowledgement

thanks to the authors of following related projects:

docker-ubuntu-desktop's People

Contributors

gezp avatar utopeadia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-ubuntu-desktop's Issues

nomachine内无法启动vscode

大佬,您好,非常感谢您的docker镜像。我现在遇到一个问题,不管我在docker内用chrome下载deb包,还是命令行安装vscode后,都无法打开vscode。app列表里,和终端运行code指令,都无法启动。我在宿主机里已经提前运行xhost +指令,opengl也能正常显示我的显卡。当然vscode通过ssh是可以的。

docker里面的opengl版本过低怎么办,low version opengl

我的宿主机opengl版本是4.6,而我用您提供的dockerfile安装的docker-ubuntu20-desktop里的opengl版本是3.1,但是我又不想重新做一个新的镜像和容器来修改opengl版本,怎么将现有的容器提升opengl版本。在这之前,我已经尝试docker run --gpus all或者docker run --device nvidia相关的配置,但都没有效果,请问您是否有好的解决办法。
The opengl version of my host is 4.6, and the opengl version in docker-ubuntu20-desktop I installed using the dockerfile you provided is 3.1, but I don’t want to create a new image and container to modify the opengl version. How can I change the existing opengl version? Some containers upgrade the opengl version. Before this, I have tried the #docker run --gpus all# or #docker run --device nvidiaxxx# commands, but they have no effect. Do you have any good solutions?

vglrun open3d报错

作者你好,我是服务器上使用你的这个docker, xhost +会报错xhost: unable to open display "",但是后面都是没问题的,之后,用nomachin连接,进入图形界面之后
glxgearsvglrun glxgears 都正常运行,但是我在运行vglrun open3d draw时会报错
[VGL] ERROR: OpenGL error 0x0502 [VGL] ERROR: in createBuffer--
我查看容器里$DISPLAY为:1001,我运行vglrun -d :1001 open3d draw不会报错但是又没有GPU加速的效果,vglrun glxgears是可以正常加速的,我现在不知道怎么用vglrun加速open3d的渲染,请问有什么建议吗

Docker容器中vkcube报错,求助

容器创建命令:
docker run -d --restart=on-failure
--name my_desktop
--cap-add=SYS_PTRACE
--gpus all
--shm-size=1024m
-p 10022:22
-p 14000:4000
gezp/ubuntu-desktop:20.04-cu11.0.3
执行 vulkaninfo | grep -i "GPU":
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
GPU id : 0 (NVIDIA GeForce RTX 4090)
GPU id : 1 (llvmpipe (LLVM 12.0.0, 256 bits))
GPU id : 2 (NVIDIA GeForce RTX 4090)
GPU id : 0 (NVIDIA GeForce RTX 4090)
GPU id : 1 (llvmpipe (LLVM 12.0.0, 256 bits))
GPU id : 2 (NVIDIA GeForce RTX 4090)
GPU id : 0 (NVIDIA GeForce RTX 4090)
GPU id : 1 (llvmpipe (LLVM 12.0.0, 256 bits))
GPU id : 2 (NVIDIA GeForce RTX 4090)
GPU id : 0 (NVIDIA GeForce RTX 4090):
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
GPU id : 1 (llvmpipe (LLVM 12.0.0, 256 bits)):
GPU id : 2 (NVIDIA GeForce RTX 4090):
GPU0:
deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
GPU1:
GPU2:
deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
然后执行vkcube时报错:
vkcube: /build/vulkan-tools-KEbD_A/vulkan-tools-1.2.131.1+dfsg1/cube/cube.c:1331: demo_prepare_buffers: Assertion `!err' failed.
Aborted (core dumped)
求助

容器中如何使用3d加速gazebo仿真

按照您的方法启动容器后,无论如何设置,都无法启动vglrun gazebo
使用的命令是:

docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    --gpus all  \
    --shm-size=10240m \
    -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
    -p 10022:22  \
    -p 14000:4000  \
    gezp/ubuntu-desktop:20.04-cu11.2.0

nomachine连接,在xfce-terminal中的报错是

$ vglrun gazebo
[VGL] ERROR: Could not open display :0

宿主机DISPLAY变量为(连接有一台显示器)

$ echo $DISPLAY
:0

想问下docker容器中具体配置3d加速的过程是什么,谢谢🙏,上面步骤是有什么错误吗,我在2080ti和3090机器上测试都不行

DISPLAY=:1 无法更改

您好,我在ubuntu20宿主机上操作,默认的$DISPLAY为:1, 尝试了很多办法都修改不了这个,另外想问下为什么这里只能:0吗?

How to open it through Nomachine in a Windows host

I successfully made a container and can viewed ubuntu desktop GUI in my Unbutu host.
But when I tried the same process in Windows 11, nomachine can not find the container's desktop.
I would like to ask how should I fix the problem.
Nomachine server setting in host ubuntu shows nx:// and ssh both, but in host windows nomachine only shows nx:// with no ssh

容器中vgl服务报错

大佬您好 感谢您分享非常牛的镜像
我在使用时出现了如下vgl错误

[VGL] ERROR: Could not load function 'dlopen'
[VGL] /usr/NX/scripts/vgl/libvglfaker.so: undefined symbol: dlopen

并导致节点process died. 请问这是因为VGL正在被虚拟桌面占用吗?有什么可能的解决办法呢?谢谢!

--cap-add=SYS_PTRACE?

您好,我发现docker run必须添加--cap-add=SYS_PTRACE nomachine才能连上,有没有办法去掉这条命令?实验室的服务器无法添加--cap-add=SYS_PTRACE

使用-v命令挂载用户目录导致nomachine无法创建桌面

挂载在root目录下可以

docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    -v /home/user/Programs/:/root/Programs/ \
    --gpus all  \
    -e USER=user \
    -e PASSWORD=user \
    -e GID=1001 \
    -e UID=1001 \
    --shm-size=1024m \
    -p 8022:22  \
    -p 8400:4000  \
    gezp/ubuntu-desktop:20.04-cu11.3.1

挂载在用户目录下nomachine无法创建桌面

docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    -v /home/user/Programs/:/home/user/Programs/ \
    --gpus all  \
    -e USER=user \
    -e PASSWORD=user \
    -e GID=1001 \
    -e UID=1001 \
    --shm-size=1024m \
    -p 8022:22  \
    -p 8400:4000  \
    gezp/ubuntu-desktop:20.04-cu11.3.1

多卡3D渲染

请问这个怎么支持使用多卡进行3D渲染啊,或者我该如何实现不同的容器分配不同的显卡进行3D渲染呀,感谢感谢!

nomachine客户端无法连接容器

运行一段时间后连接nomachine提示Authentication failed, please try again!
重装之后仍然显示上述错误,ssh连接正常但ubuntu用户无root权限,显示
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
查看nomachine运行情况显示

root@e654864038aa:/#/usr/NX/bin/nxserver--status
NX>111 New connections to NoMachine server are enabled.
NX>161 Enabled service:nxserver.
NX>162 Disabled service:nxnode.
NX>161 Enabled service:nxd.

部署环境是dell服务器
正常安装docker和镜像所需环境
更改了docker的默认镜像容器储存位置为外置硬盘
无其他更改

Nomachine连接不上容器

连接提示Authentication failed, please try again!
重装之后仍然显示上述错误,ssh连接正常

nomachine is black screen with ubuntu-desktop:22.04-cu12.x.x

The docker image gezp/ubuntu-desktop:22.04-cu12.x.x cannot be connected by nomachine. However, gezp/ubuntu-desktop:20.04-cu11.x.x works well.

The host machine is ubuntu 20.04 with nvidia driver correctly installed and the nomachine client is installed in a macbook pro with the M2 Max chip.

I can't pull your image

It keeps showing up as waiting - "1731132f4b49: Waiting" when I pull your image.
Thank you.

Please support ARM-based machine

I got the following error while running docker run -d --restart=on-failure --name my_workspace --cap-add=SYS_PTRACE --gpus all --shm-size=1024m -p 10022:22 -p 14000:4000 gezp/ubuntu-desktop:22.04-cu12.1.1:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
9254d6b71b2a006637d0597e84d90a3781dcb2e4a3a538aee3ef783060233443
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

SSH执行glxinfo报错

作者你好,我在本地用vscode远程连接这个容器,执行vglrun一些3D程序会报glx相关的错
我执行vglrun glxinfo会报display :0的错
执行vglrun -d :10 glxinfo
[VGL] NOTICE: Automatically setting VGL_CLIENT environment variable to
[VGL] 10.10.0.212, the IP address of your SSH client.
name of display: localhost:10.0
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 149 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 66
Current serial number in output stream: 67
但是我执行xeyes是可以正常调出GUI的,能给我一些建议吗

无法使用systemd

$sudo systemctl daemon-reload
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

VirtualGL Problem

我是在本地使用你的这个docker,把它当成了类似虚拟机的东西。
本地系统ubuntu20.04, Nvidia Driver Version: 510.60.02 CUDA Version: 11.6.

$ xhost +
>>> access control disabled, clients can connect from any host

$ docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    --gpus all  \
    --shm-size=1024m \
    -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
    -p 10022:22  \
    -p 14000:4000  \
    gezp/ubuntu-desktop:20.04-cu11.0

之后,用nomachin连接是没有问题的,进入图形界面之后我尝试了

$ glxgears

也是完全OK的。
但是使用VirtualGL的时候出现了问题, 输入如下命令之后就没有反应了,我可以任意拖动终端,看起来应该是在运行,但是却什么都没有显示。

$ vglrun glxgears

值得注意的是我本地(容器外)的${DISPLAY}为1

$ echo ${DISPLAY}
>>> :1

之后我尝试了一些办法,比如dicker运行的时候加入 -e DISPLAY=:1

docker run -d --restart=on-failure \
    --name my_workspace \
    --cap-add=SYS_PTRACE \
    --env="QT_X11_NO_MITSHM=1" \
    --gpus all  \
    --shm-size=1024m \
    -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
    -e DISPLAY=:1 \
    -p 10022:22  \
    -p 14000:4000  \
    gezp/ubuntu-desktop:20.04-cu11.0

但是还是没有显示

我之后查看了我本地的两个文件

/home/steve/.nx/nxerror.log
/usr/NX/var/log/nxerror.log

我发现有以下问题:

1279 117188 22:59:11 012.525 ServerNetworkInfoHandler: WARNING! Obtaining network data failed with result -3.
1279 117439 23:01:01 776.566 ServerNetworkInfoHandler: WARNING! Obtaining network data failed with result -7.
1279 1675 23:31:43 029.917 HostWmRunning: WARNING! Giving up after 500 Ms.
/bin/xauth:  file /home/steve/.Xauthority does not exist
1279 122503 23:31:49 092.812 HostWmRunningHelper: WARNING! Failed to open display ':1'.

但是不知道如何解决。请问有什么建议么?

xhost question

我们有一个在机房的服务器,已经插上了HDMI欺骗器,然后export display的环境变量。但是执行xhost +时提示
xhost: unable to open display ":0",应该怎么做?docker可以正常运行,可以通过ssh访问。和hdmi欺骗器插的显卡有关吗,我们有8张显卡,我随便找了一个插上去了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.