A lightweight (492 MB) personal Linux workstation based on Alpine. Provides VNC and SSH.
6.7K
A lightweight (447 MB) personal Linux workstation based on Alpine. Provides VNC and SSH services.
Ramon Solano (<ramon.solano at gmail.com>)
Last update: May/29/2022
Base image: Alpine:3.16
Now built as dual arch AMD/ARM 64 image
| User | Password |
|---|---|
| root | alpine |
| alpine | alpine |
Manually download it (pull it) from its docker hub repository:
$ docker pull rsolano/alpine-vnc
Run the container (the image will be pulled first if not previously downloaded).
For example, to run an ephemeral VNC session:
$ docker run --rm -p 5900:5900 rsolano/alpine-vnc
To run an ephemeral VNC + SSH session:
$ docker run --rm -p 5900:5900 -p 2222:22 rsolano/alpine-vnc
Dockerfile (optional)If you want to customize the image or use it for creating a new one based on this configuration, you can download (clone) the full image files from the corresponding github repository.
# clone git repository
$ git clone https://github.com/rwildcat/docker_alpine-vnc.git
# build image
$ cd docker_alpine-vnc
$ docker build -t rsolano/alpine-vnc .
To run the container, you can just issue the $ docker run command. The image will be first pulled if it required:
$ docker run [-it] [--rm] [--detach] [-h HOSTNAME] -p LVNCPORT:5900 -p LSSHPORT:22 [-e XRES=1280x800x24] [-e TZ=Etc/UTC] [-v LDIR:DIR] rsolano/alpine-vnc
where:
LVNCPORT: Localhost VNC port to connect to (e.g. 5900 for display :0)
LSSHPORT: local SSH port to connect to (e.g. 2222, as well known ports (those below 1024) may be reserved by your system)
XRES: Screen resolution and color depth (e.g 1280x800x24)
TZ: Area/City (e.g. America/Los_Angeles, America/Mexico_City, etc.)
LDIR:DIR: Local directory to mount on container. LDIR is the local directory to export; DIR is the target dir on the container. Both sholud be specified as absolute paths. For example: -v $HOME/worskpace:/home/alpine/workspace.
Run the image, remove container from memory once finished the container (--rm); map local VNC port 5900 to guest's VNC port 5900 (-p 5900:5900), and local port 2222 to guest's 22 (-p 2222:22) for SSH access:
$ docker run --rm -p 5900:5900 -p 2222:22 rsolano/alpine-vnc
Run image, remove container from memory once finished the container; map VNC port to 5900 and SSH port to 2222; mount local $HOME/workspace on container's /home/alpine/workspace (-v $HOME/...):
$ docker run --rm -p 5900:5900 -p 2222:22 -v $HOME/workspace:/home/alpine/workspace rsolano/alpine-vnc
Run image, detach to background (--detach, or just -d) and keep running in background (control returns to user immediately); map VNC to 5900 and SSH to 2222; change screen resolution to 1200x700x24 (XRES=1280x1024x24)
$ docker run --detach -p 5900:5900 -p 2222:22 -e XRES=1280x10240x24 rsolano/alpine-vnc
This container is intended to be used as a personal graphic workstation, running in your local Docker engine. For this reason, no encryption for VNC is provided.
If you need to have an encrypted connection as for example for running this image in a remote host (e.g. AWS, Google Cloud, etc.), the VNC stream can be encrypted through a SSH connection:
$ ssh [-p SSHPORT] [-f] -L 5900:REMOTE:5900 alpine@REMOTE sleep 60
where:
SSHPORT: SSH port specified when container was launched. If not specified, port 22 is used.
-f: Request SSH to go to background afte the command is issued
REMOTE: IP or qualified name for your remote container
This example assume the SSH connection will be terminated after 60 seconds if no VNC connection is detected, or just after the VNC connection was finished.
EXAMPLES:
Establish a secured VNC session to the remote host 140.172.18.21, keep open a SSH terminal to the remote host. Map remote 5900 port to local 5900 port. Assume remote SSH port is 22:
$ ssh -L 5900:140.172.18.21:5900 [email protected]
As before, but do not keep a SSH session open, but send the connecction to the background. End SSH channel if no VNC connection is made in 60 s, or after the VNC session ends:
$ ssh -f -L 5900:140.172.18.21:5900 [email protected] sleep 60
Once VNC is tunneled through SSH, you can connect your VNC viewer to you specified localhot port (e.g. port 5900 as in this examples).
If running an interactive session:
CTRL-C in the interactive terminal.If running a non-interactive session:
CTRL-C in the console (non-interactive) terminal.If running detached (background) session:
Look for the container Id with docker ps:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ac46f0cf41d1 rsolano/alpine-vnc "/usr/bin/supervisor…" 58 seconds ago Up 57 seconds 0.0.0.0:5900->5900/tcp, 0.0.0.0:2222->22/tcp wizardly_bohr
Stop the desired container Id (ac46f0cf41d1 in this case):
$ docker stop ac46f0cf41d1
First run the container as described above.
Connect to the running host (localhost if running in your computer):
Using VNC:
Connect to specified LVNCPORT (e.g. localhost:0 or localhost:5900)
Using SSH:
Connect to specified host (e.g. localhost) and SSHPORT (e.g. 2222)
$ ssh -p 2222 alpine@localhost
./etc/supervisor.conf
[supervisord]
nodaemon = true
user = root
#loglevel = debug
[program:sshd]
command = /usr/sbin/sshd -D
[program:xvfb]
command = /usr/bin/Xvfb :1 -screen 0 %(ENV_XRES)s
priority=100
[program:x11vnc]
environment = DISPLAY=":1",XAUTHLOCALHOSTNAME="localhost"
command=/usr/bin/x11vnc -repeat -xkb -noxrecord -noxfixes -noxdamage -wait 10 -shared -permitfiletransfer -tightfilexfer
autorestart = true
priority=200
[program:startxfce4]
environment=USER="alpine",HOME="/home/alpine",DISPLAY=":1"
command=/usr/bin/startxfce4
directory = /home/alpine
user=alpine
priority=300
Content type
Image
Digest
Size
162.1 MB
Last updated
over 4 years ago
docker pull rsolano/alpine-vnc