Skip to content

Repository files navigation

中文

electerm-web-docker

docker image of electerm-web

electerm is an open-sourced terminal/ssh/sftp/ftp/telnet/serialport/RDP/VNC/Spice client (Linux, Mac, Windows, Android, HarmonyOS, iOS). This image packages the browser-based electerm-web for easy self-hosting with Docker.

About electerm

Besides the mainstream Windows / macOS / Linux / Android platforms, electerm also supports HarmonyOS and older systems such as Ubuntu 18, Windows 7, macOS 10+, as well as domestic Linux distributions like UOS, Kylin, and LoongArch (both old-world and new-world), as well as RISC-V (riscv64) and PowerPC 64-bit little-endian (ppc64le) Linux.

Use

# Use --user flag to run as current user (avoids permission issues on Linux)
# Change $(pwd)/electerm-web-data to your preferred data folder

docker run --init \
  -v $(pwd)/electerm-web-data:/home/electerm/data \
  -e "DB_PATH=/home/electerm/data" \
  -e "HOST=0.0.0.0" \
  -p 8082:5577 \
  zxdong262/electerm-web

With authentication (optional)

docker run --init \
  -v $(pwd)/electerm-web-data:/home/electerm/data \
  -e "DB_PATH=/home/electerm/data" \
  -e "HOST=0.0.0.0" \
  -e "SERVER_SECRET=some_server_secret" \
  -e "SERVER_PASS=password_to_login" \
  -e "ENABLE_AUTH=1" \
  -p 8082:5577 \
  zxdong262/electerm-web

Serve under a sub-path (optional)

BASE_PATH lets the app sit under a path such as https://host/electerm/, which is how you put it behind an existing nginx next to other apps. It is a runtime env var, so no rebuild is needed — just add it:

docker run --init \
  -v $(pwd)/electerm-web-data:/home/electerm/data \
  -e "DB_PATH=/home/electerm/data" \
  -e "HOST=0.0.0.0" \
  -e "BASE_PATH=/electerm" \
  -p 8082:5577 \
  zxdong262/electerm-web

The page then emits /electerm/... for stylesheets, scripts, api and the websocket url, and the server accepts both the prefixed and the plain path, so the proxy may forward either verbatim or with the prefix stripped. A resource mounted at the root (GET /) keeps working too. See examples/nginx-subpath.conf.

Requires an image built from electerm-web 5.10.x or newer; older images ignore BASE_PATH and return 404 for the prefixed paths.

Then visit http://127.0.0.1:8082 in browser.

Check examples/nginx.conf examples/nginx-ssl.conf for domain binding nginx conf example.

Docker Compose

version: '3.8'
services:
  electerm-web:
    image: zxdong262/electerm-web:latest
    container_name: electerm-web
    volumes:
      - ./electerm-data:/home/electerm/data
    environment:
      - DB_PATH=/home/electerm/data
      - HOST=0.0.0.0
      # Serve under https://host/electerm/ (needs electerm-web 5.10.x+):
      # - BASE_PATH=/electerm
      # Optional authentication:
      # - SERVER_SECRET=some_server_secret
      # - SERVER_PASS=password_to_login
      # - ENABLE_AUTH=1
    ports:
      - "8082:5577"
    init: true
    restart: unless-stopped
# Run with current user's UID/GID
UID=$(id -u) GID=$(id -g) docker-compose up -d

Docker hub url

https://hub.docker.com/r/zxdong262/electerm-web

Related projects/sites

License

MIT

Releases

Packages

Used by

Contributors

Languages