Skip to content

A tool used to load terminals in the browser with docker using `dockerode`, `node-pty` and `ansi-up`

Notifications You must be signed in to change notification settings

linuxfandudeguy/berm

Repository files navigation

berm

demo vid Screenshot 2024-09-29 4 16 09 PM

berm is a tool that allows you to run Docker shell images in the browser.

Prerequisites

Before installing berm, ensure that you have the following:

  • The docker.io package installed on your computer. You can install it using your package manager. For example, on Ubuntu, you can run:

    sudo apt-get install docker.io
  • Node.js installed on your machine.

Installation Methods

Using PNPM (Highly Recommended)

Click to Show PNPM Instructions

To initiate berm using PNPM, you can use one of the two methods below:

Method 1: PNPM Init

pnpm create berm

Method 2: PNPM DLX

pnpm dlx create-berm@1.0.0

After the installation, you can start the server with:

pnpm run start
# or
pnpm start

Using NPX

Click to Show NPX Instructions

To initiate berm using NPX, you can use one of the two methods below:

Method 1: NPX Init

npx init berm

Method 2: NPX Create

npx create-berm@1.0.0

After the setup, start the server with:

npx run start
# or
npx start

Using NPM

Click to Show NPM Instructions

You can initiate berm using NPM as follows:

Method 1: NPM Init

npm init berm

Method 2: NPM Exec

npm exec create-berm@1.0.0

Once the installation is complete, start the server with:

npm run start
# or
npm start

Using Yarn

Click to Show Yarn Instructions

To initiate berm using Yarn, you can use one of the two methods below:

Method 1: Yarn Init

yarn init berm

Method 2: Yarn Create

yarn create berm@1.0.0

After the installation, start the server with:

yarn run start
# or
yarn start

Using Bun

Click to Show Bun Instructions

If you're using Bun, initiate berm with one of the following methods:

Method 1: Bun Init

bun init berm

Method 2: Bun Create

bun create berm@1.0.0

After installation, start the server with:

bun run start
# or
bun start

Customization

The docker image can be customized at line 18 in the server.js file.

const container = await docker.createContainer({
Image: 'archlinux', // Use your Docker image
Tty: true,
OpenStdin: true,
 StdinOnce: false,
               });

You can change the Image field to whatever you want.

By default it loads the Arch Linux Docker image.

If you did it right, it should log these following messages to the console:

Server running at http://localhost:3000
Container started: 2a8e1b27d0f5b538ef9b0bcad5c03d1deb8615ae33b46428188812b5e70d6c05

In this example:

  • The server is running locally at http://localhost:3000.
  • The Docker container has started, and the container ID is: 2a8e1b27d0f5b538ef9b0bcad5c03d1deb8615ae33b46428188812b5e70d6c05. This long hexadecimal string is the unique identifier for your Docker container.

This ID will change depending on what docker image you decide to load.

Features

  • Browser-Based Execution: Run Docker images directly in your browser without the need for local Docker installation.
  • Compatibility: Supports a variety of Docker images, allowing for flexible usage scenarios.
  • Lightweight: Efficiently runs terminal applications without the overhead of a full Docker environment.

Contributing

Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.