This guide will show you how to set up a VNC in Coder.
Coder does not have a specific set of VNC providers it supports. Coder will render the VNC, as long as it is installed on the image used to create the workspace.
Step 1: Create the Dockerfile
To begin, create a Dockerfile that you'll use to build an image with a VNC provider installed.
Be sure to set the
PORT environment variables in the
HOME=/home/coder USER coder PORT 1234
PORT to the appropriate port number for your VNC instance.
To help you get started, see this sample image that uses noVNC as the client and TigerVNC as the server.
Step 2: Build and push the image to Docker Hub
Once you've created your image, build and push it to Docker Hub:
docker build . -t <yourusername>/vnc docker push <yourusername>/vnc
Step 3: Import the image into Coder
Now that your image is available via Docker Hub, you can import it for use in Coder.
Log in to Coder and go to Images > Import Image
Import or select a registry.
Provide the Repository and Tag of the VNC image. Optionally, you can include a Description and the Source Repo URL that refers to the image's source.
Set the recommended resources (CPU cores, memory, disk space) for your VNC instance.
Click Import Image.
Step 4: Create a workspace with the image
Once you've imported your image into Coder, you can use it to create an workspace.
In the Coder UI, go to the workspace overview page. Click New Workspace and choose Custom Workspace
Provide a Workspace Name, and indicate that your Image Source is Existing.
Select your Image and associated Tag.
Click Create Workspace
Connecting to Coder
There are two ways you can connect to your workspace:
- Connect via the web
- Connect using a local VNC client
Option 1: Connect via web
If your image includes noVNC, or another web-based client, you can use a dev URL to access it securely.
From the workspace overview page, click Add URL
Provide the Port number that the VNC web client is running on (this information is defined in the image you used to build this workspace).
Provide a name for the dev URL.
You can now access the VNC in Coder by clicking the Open in Browser icon (this will launch a separate window).
Option 2: Connect using a local VNC client
If your Coder deployment has ssh enabled, you can also connect to Coder using a local client with SSH port forwarding.
You will need to install coder-cli and a VNC client on your local machine.
Run the following commands on your local machine to connect to the VNC server.
[vnc-port] with the port on which the server is running and
[workspace-name] with the workspace you created in Step 4.
Ensure the workspace you created is an SSH target coder config-ssh Forward the remote VNC server to your local machine Note that you will not see any output if this succeeds ssh -L -N [vnc-port]:localhost:localhost:[vnc-port] coder.[workspace-name] At this point, you can connect your VNC client to localhost:[vnc-port]