Docker-Vnc Desktop Configuration.
This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!
When using public servers, users typically have regular user accounts with limited permissions, unable to configure the server freely according to their preferences. To meet this demand, Docker is often used to allow root privileges within containers for environment configuration. VNC, a commonly used remote desktop tool, facilitates server-side rendering of graphical interfaces, which is particularly useful for experiments requiring interfaces (such as mujoco, habitat, igibson environments). This article mainly discusses configuring VNC desktop within Docker and provides a pre-packaged image: kezhiadore/ubuntu-vnc - Docker Image | Docker Hub
First, start from an initial Ubuntu 18.04 image, download, launch, and enter the container:
1 | docker pull ubuntu:bionic |
As this container doesn't have a desktop, install the xfce4 desktop:
1 | apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils |
Then, install vncserver after entering:
1 | apt update |
Configure startup files in the user directory:
1 | apt install vim |
Start vncserver:
1 | vncserver :1 |
The vncserver needs initial configuration for passwords. Once configured, use a vnc client to access port 5091 to connect to the remote desktop.
Tips
- After entering the desktop, some applications like Google Chrome may not run under root user mode. Creating a user and launching the remote desktop under that user's identity can resolve this.
- If you encounter issues with terminal not opening, change
application->settings->preference
in the terminal settings. - Chinese display garbled characters may result from font and encoding issues. You can refer to the following tutorials for solutions: