- Notifications
You must be signed in to change notification settings - Fork11
🖥 Remote desktop in a container
License
dmotte/desktainer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
💻 Remotedesktop in a container.
📦 This image is also onDocker Hub as
dmotte/desktainer
and runs onseveral architectures (e.g. amd64, arm64, ...). To see the full list of supported platforms, please refer to the.github/workflows/main.yml
file. If you need an architecture which is currently unsupported, feel free to open an issue.
Thanks tofcwu/docker-ubuntu-vnc-desktop andsoffchen/tiny-remote-desktop for the inspiration.
The simplest way to try this image is:
docker run -it --rm -p6901:6901 dmotte/desktainer
Note: since some GUI applications may have issues with Docker's defaultseccomp profile, you may need to use
--security-opt seccomp=unconfined
Then head over tohttp://localhost:6901/ to access the remote desktop.
Thedocker-compose.yml
file contains a complete usage example for this image. Feel free to simplify it and adapt it to your needs. Unless you want to build the image from scratch, comment out thebuild: build
line to use the pre-built one fromDocker Hub instead.
To start the Docker-Compose stack in daemon (detached) mode:
docker-compose up -d
Then you can view the logs using this command:
docker-compose logs -ft
- 💡 If you want tochange the resolution while the container is running, you can use the
xrandr --fb 1024x768
command. The new resolution cannot be larger than the one specified in theRESOLUTION
environment variable though - 💡 If you need to, you can extend this project by making your own
Dockerfile
starting from this image (i.e.FROM dmotte/desktainer
) and/or mount customsupervisor configuration files. See theexample
folder for an example of how to do it - 💡 This image is not meant to be run with the
--user
Docker option, because thestartup.sh
script needs to run as root in the initial phase. Moreover, the user created via theMAINUSER_NAME
environment variable (see below) will be asudoer, so running the container as root is useful in any case. If you want arootless version of this image, check outdmotte/desktainer-rootless
If you need to run commands at container startup, you can create Bash scripts in the following locations:
/opt/startup-early/*.sh
: these scripts will be included in alphabetical orderbefore the main container initialization process/opt/startup-late/*.sh
: these scripts will be included in alphabetical orderafter the main container initialization process
See thestartup.sh
script for more details.
Moreover, if you need to run commands after the LXDE startup, you can create launcher files in the/etc/xdg/autostart
or the~/.config/autostart
directory.
List of supportedenvironment variables:
Variable | Required | Description |
---|---|---|
RESOLUTION | No (default: 1920x1080) | Screen resolution |
MAINUSER_NAME | No (default: mainuser) | Name of the main user. If set toroot , no user will be created and the main user will be root |
MAINUSER_PASS | No (default:mainuser ) | Password of the main user (ifMAINUSER_NAME != root ) |
MAINUSER_NOPASSWORD | No (default:false ) | Whether or not the main user should be allowed tosudo without password |
VNC_PASS | No (default: none) | Password for the VNC server |
VNC_PORT | No (default: 5901) | TCP port of the VNC server |
NOVNC_PORT | No (default: 6901) | TCP port of the noVNC webserver |
If you want to contribute to this project, you can use the following one-liner torebuild the image and bring up theDocker-Compose stack every time you make a change to the code:
docker-compose down&& docker-compose up --build
Note: I know that this Docker image has manylayers, but this shouldn't be a problem in most cases. If you want to reduce its number of layers, there are several techniques out there, e.g. seethis
About
🖥 Remote desktop in a container