https://github.com/pratikshinde55/docker-gui_container
Setting Up and Accessing a GUI Container on EC2 Using VNC
https://github.com/pratikshinde55/docker-gui_container
docker docker-container docker-gui tightvnc vnc-viewer
Last synced: 4 months ago
JSON representation
Setting Up and Accessing a GUI Container on EC2 Using VNC
- Host: GitHub
- URL: https://github.com/pratikshinde55/docker-gui_container
- Owner: Pratikshinde55
- Created: 2024-07-28T08:05:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-25T12:57:16.000Z (over 1 year ago)
- Last Synced: 2025-04-05T19:18:48.227Z (about 1 year ago)
- Topics: docker, docker-container, docker-gui, tightvnc, vnc-viewer
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker-GUI_Container

- Description:
In this task, we will set up a GUI container on an EC2 Ubuntu instance using Docker and access it remotely via VNC.
The process involves pulling and running a Docker image that provides an Ubuntu environment
with an XFCE desktop environment and a VNC server. We will then access this environment using TightVNC Viewer and a web browser.
- Prerequisites:
1. AWS Account: (I use EC2 instance as OS for docker and AMI-ubuntu)
2. Security Group Settings:
(Modify the security group associated with your EC2 instance to allow inbound traffic on the following ports:
Port 22 (SSH), Port 5901 (VNC), Port 6901 (noVNC),Port 80 (HTTP) ).

3. Local Machine Setup:
(TightVNC Viewer installed on your local machine for accessing the VNC server).
4. Putty (SSH access to the EC2 instance ).
### Step-1: [Install Docker and Start Docker services]
sudo apt-get update
Install Docker commad for ubuntu:
sudo apt-get install -y docker.io
Start Docker service command:
sudo systemctl start docker
### Step-2: [Launch Container using image which support GUI]
- Note:
The "consol/ubuntu-xfce-vnc" Docker image is designed to provide a lightweight, easy-to-use VNC (Virtual Network Computing)
server environment running on an Ubuntu base with the Xfce desktop environment. This image allows you to run GUI applications
within a container and access them remotely via a VNC client.
sudo docker pull consol/ubuntu-xfce-vnc
Lanuch container in detached Mode and expose:
sudo docker run -d --name=pratik1 -p 5901:5901 -p 6901:6901 -e VNC_PASSWORD=pratik consol/ubuntu-xfce-vnc
here,
**-d: Run the container in detached mode.**
**-p 5901:5901: Map port 5901 of the container to port 5901 of the host (VNC access).**
**-p 6901:6901: Map port 6901 of the container to port 6901 of the host (web-based VNC access).**
**-e environmental variables**
Now check container logs and we get image build details:
sudo docker logs pratik1
- Note:
we can try to connect container from outside (browser) world.
here show error while connecting to container by HTTP (http://52.90.226.27:6901/?password=pratik) we write password then also unable to connect -

#### TightVNC Viewer:
[TightVNC-download-link](https://www.tightvnc.com/download.php)
*TightVNC is a remote desktop software that allows you to see and control a remote computer's desktop. It uses the RFB (Remote FrameBuffer) protocol
and is an improved version of the standard VNC (Virtual Network Computing) software.*
Now using TightVNC viewer for GUI container:
Fill public Ip of EC2 and port no. -->> (52.90.226.27:5901)

While fill password also unble to connect GUI container :

- Note : (Authentication Failure)
I can manually reset the VNC password by attaching to the running container and using the "vncpasswd" command.
sudo docker exec -it pratik1 bash
Set new VNC password inside the Container cmd:
vncpasswd
After resetting the password, restart the VNC server within the container:
vncserver -kill :1
vncserver :1

### Step-3: [On Browser]
Now again check on Browser with newly saved password (newpassowrd - pratik55)
public IP of EC2 : port no (http://52.90.226.27:6901/?password=pratik55)

- check GUI Container from TightVNC viewer:
fill new password

## Summary
- Docker Setup on EC2 Instance:
Install Docker on your EC2 instance.
Pull a Docker image capable of running a GUI application with VNC support.
- Running the Docker Container:
Start the Docker container with ports 5901 and 6901 exposed for VNC and noVNC access.
Set a VNC password.
- Connecting via TightVNC Viewer:
Use TightVNC Viewer on your local machine to connect to the VNC server running in the Docker container on the EC2 instance.