Skip to content

A repository for a personal project of creating a Dockerized Alpine Linux virtual machine accessible through a web CLI

Notifications You must be signed in to change notification settings

SaladVlad/docker-WeTTY-Alpine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker Container Setup for WeTTY

This README provides instructions on how to set up and run a Docker container that installs and configures WeTTY, a web-based terminal for accessing the shell in your browser. This is a standalone Alpine Linux instance, and you can do anything terminal-based inside the browser. This kind of setup is a bit meta because you can technically do anything: stop/remove the node terminal service (or nuke the entire system using the rm -rf / command)

Try it out <== This particular instance is kept alive on Render deplyment services using a Cron-Job externally pinging the service to provide a kept state

On the deployed instance, you can:

  • Play Doom by running DOOM/doom_ascii
  • See the rainbow matrix with cmatrix | lolcat
  • Use neofetch to display system information
  • Unzip files with unzip
  • Download files with wget
  • Edit files with the VIM editor
  • Install or do anything else supported by the linux OS

Prerequisites

Ensure you have the following installed on your machine:

Dockerfile Overview

This Dockerfile sets up a container using Alpine Linux and installs the necessary dependencies to run WeTTY. The container is pre-configured to:

  1. Install required packages like Python, Node.js, Git, and WeTTY dependencies.
  2. Set up a Python virtual environment and install Python packages.
  3. Clone the WeTTY repository and install its dependencies using pnpm.
  4. Clean up unnecessary files to keep the image size small.
  5. Expose port 3000 to access the web terminal.

Setting Up the Docker Container

Step 1: Clone the Repository

If you want to modify or track changes in the Dockerfile, first clone the repository with the following command:

git clone https://github.com/SaladVlad/docker-WeTTY-Alpine.git
cd docker-WeTTY-Alpine

If you only want to build the Docker image without cloning the repository, you can proceed with the next step.

Step 2: Build the Docker Image

To build the Docker image using the provided Dockerfile, use the following Docker command. This assumes you are in the same directory as the Dockerfile:

docker build -t wetty-docker .
  • -t wetty-docker: This tag gives the image a name (wetty-docker), which you can use to reference the image later.

Step 3: Run the Docker Container

Once the image is built, you can run the container with the following command:

docker run -d -p 3000:3000 --name wetty-container wetty-docker
  • -d: Run the container in detached mode (in the background).
  • -p 3000:3000: Exposes port 3000 from the container to port 3000 on your host machine. This will be the port where WeTTY is available in your browser.
  • --name wetty-container: Assigns a name to the running container.
  • wetty-docker: The name of the image to run.

Step 4: Access the Web Terminal

Once the container is running, you can access the terminal through your browser by navigating to:

http://localhost:3000

You'll be prompted with a web-based terminal, where you can interact with your container's shell.

Step 5: Stopping and Removing the Container

To stop the running container:

docker stop wetty-container

To remove the container after stopping it:

docker rm wetty-container

Notes

  • This Dockerfile automatically installs WeTTY and configures it to use bash as the default shell.
  • The container exposes port 3000 to allow access to the web terminal through the browser.
  • The virtual environment (/venv) is set up with Python 3 and several Python dependencies, including setuptools and virtualenv.
  • If you wish to use a different shell or command, modify the CMD line in the Dockerfile.

Troubleshooting

  • Error: Could not connect to port 3000
    Ensure the container is running (docker ps) and that the port mapping (-p 3000:3000) is correctly set.

  • Error: No command found
    Verify that the necessary binaries are installed by using the apk package manager, or checking the Dockerfile commands for proper package installation.

Conclusion

You have successfully built and deployed WeTTY using Docker! Enjoy accessing your terminal through the browser with full shell capabilities.


About

A repository for a personal project of creating a Dockerized Alpine Linux virtual machine accessible through a web CLI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published