{"id":24803940,"url":"https://github.com/raonigabriel/web-terminal","last_synced_at":"2025-08-10T12:08:37.207Z","repository":{"id":52193817,"uuid":"319728579","full_name":"raonigabriel/web-terminal","owner":"raonigabriel","description":"This is a lightweight Docker image that opens a web-based terminal session. ","archived":false,"fork":false,"pushed_at":"2021-08-30T18:43:28.000Z","size":20,"stargazers_count":59,"open_issues_count":0,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T15:59:17.269Z","etag":null,"topics":["docker","ngrok","ssh","terminal","ttyd","websocket"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raonigabriel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-08T18:38:27.000Z","updated_at":"2025-05-15T01:42:39.000Z","dependencies_parsed_at":"2022-08-27T14:56:14.084Z","dependency_job_id":null,"html_url":"https://github.com/raonigabriel/web-terminal","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/raonigabriel/web-terminal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raonigabriel%2Fweb-terminal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raonigabriel%2Fweb-terminal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raonigabriel%2Fweb-terminal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raonigabriel%2Fweb-terminal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raonigabriel","download_url":"https://codeload.github.com/raonigabriel/web-terminal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raonigabriel%2Fweb-terminal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269720437,"owners_count":24464286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","ngrok","ssh","terminal","ttyd","websocket"],"created_at":"2025-01-30T06:14:07.049Z","updated_at":"2025-08-10T12:08:37.184Z","avatar_url":"https://github.com/raonigabriel.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# web-terminal\n\n## What is this?\nThis is a lightweight (~43MB) alpine based docker image that comes pre-packaged with 2 wonderful tools:\n* [ttyd](https://github.com/tsl0922/ttyd): is a simple command-line tool for sharing a terminal over the web, using WebSockets.\n* [ngrok](https://ngrok.com/): Creates reverse tunnels that allow access to your box from the internet.\n\nOn top of those, I've added socat, Nginx, OpenSSH, and OpenSSL. \nThis allows you to quickly provision an isolated (docker container) that can serve as a base for a lot of tunneling solutions. Use your imagination. :wink:\n\nIf you run this with docker option **--rm** (as bellow), keep in mind that docker will remove the container once it gets stopped. This is good if you don't want to leave any garbage behind.\n\n---\n# Multi-Arch\nThis image supports the following architectures: linux/armv7, linux/arm64, linux/386 and linux/amd64.\n\nThis means you can get it running on your RaspberryPi!\n\n---\n# Usage\n```sh\n# docker run --rm -d -p 7681:7681 raonigabriel/web-terminal:latest\n```\nThen access http://localhost:7681 to have a web-based shell. There is no enforced limit on the number of shells, but you can do that if needed, by customizing the ttyd daemon process.\n\nSee [here](https://github.com/tsl0922/ttyd#command-line-options) and [here](https://github.com/tsl0922/ttyd/wiki/Client-Options) for more help and the **CMD** line of this image's [Dockerfile](https://github.com/raonigabriel/web-terminal/blob/master/amd64/Dockerfile#L26).\n\n---\n# Advanced Usage\nThings start shining when you pair ttyd with ngrok. On one active shell, start nrgrok:\n\n```sh\nngrok http -region=sa -bind-tls=true -inspect=false localhost:7681\n```\nCheck its running:\n```\nngrok by @inconshreveable\nSession Status                online\nSession Expires               7 hours, 59 minutes\nVersion                       2.3.35\nRegion                        South America (sa)\nForwarding                    https://e0075a2a0966.ngrok.io -\u003e http://localhost:7681\n```\n\nSee the **Forwarding** line? You now have your docker-container, web-based ttyd shell exposed (over HTTPS) by ngrok to the Internet.\n\nNotice that on this example weŕe using a custom region (sa) and that weŕe only exposing HTTPS tunnel (no HTTP) and that we have disabled the ngrok admin console (usually it listens on port 4040).\n\nNow, let's try that with nginx. First, run the embedded nginx in the background (notice the ampersand) then start ngrok:\n```sh\n# nginx \u0026\n# ngrok http 80\n\nngrok by @inconshreveable\nSession Status                online\nSession Expires               7 hours, 59 minutes\nVersion                       2.3.35\nRegion                        United States (us)\nWeb Interface                 http://127.0.0.1:4040\nForwarding                    http://cf96bd9d722e.ngrok.io -\u003e http://localhost:80\nForwarding                    https://cf96bd9d722e.ngrok.io -\u003e http://localhost:80 \n```\nAnd now you have your nginx exposed to the internet over HTTP and HTPS (there are 2 **Forwarding** mappings).\nOn this example, the web interface is also enabled on port 4040.\n\nKeep in mind that you can also use any other TCP based service server because ngrok supports not only HTTP/HTTPS but also raw TCP tunnels.\n\n---\n## Extras\nTo terminate the container (and all its shells) from inside, run this aliased version of **poweroff**:\n```sh\n# poweroff\n```\nIt **WILL NOT** shut down the host, but the container instead. \n\n---\n## Docker options (ports and volumes)\nBy default, ttyd runs on port 7681 and ngrok opens and admin console on port 4040.\n\nIf you want to have access to the ngrok admin console, remember to add **-p 4040:4040** to the docker call:\n```sh\n# docker run --rm -d -p 4040:4040 -p 7681:7681 raonigabriel/web-terminal:latest\n```\n\nIf you know you will need access to the container internal ports, (nginx, openssh-server) just use add **-p** to the docker call, for an example:\n```sh\n# docker run --rm -d -p 80:80 -p 7681:7681 raonigabriel/web-terminal:latest\n```\n\nIf you want to keep the container after it exits, remove the **--rm** from the call:\n```sh\n# docker run -d -p 7681:7681 raonigabriel/web-terminal:latest\n```\n\nIf you want to use any volume(s) from the host, just bind mount it with **-v**, for an example:\n```sh\n# docker run --rm -d -v /var/run/docker.sock:/var/run/docker.sock -p 7681:7681 raonigabriel/web-terminal:latest\n```\n\n---\n## Custom (derived) image\nYou can create your own custom Docker image, inherit from this one then add the tools you want and a non-root user (recomended). See the sample **Dockerfile** bellow for a custom developer image that could be used as standard-sandboxed-environment by javascript developers:\n```docker\nFROM raonigabriel/web-terminal:latest\nRUN apk add --no-cache curl nano git g++ make npm docker-cli \u0026\u0026 \\\n    npm install -g yarn typescript @angular/cli \u0026\u0026 \\\n    addgroup -g 1000 docker \u0026\u0026 \\\n    adduser -s /bin/sh -u 1000 -D -G docker developer \u0026\u0026 \\\n    mkdir /home/developer/.ngrok2 \u0026\u0026 \\\n    echo \"web_addr: 0.0.0.0:4040\" \u003e /home/developer/.ngrok2/ngrok.yml \u0026\u0026 \\\n    echo \"tunnels:\" \u003e\u003e /home/developer/.ngrok2/ngrok.yml \u0026\u0026 \\\n    echo \"  nodejs:\" \u003e\u003e /home/developer/.ngrok2/ngrok.yml \u0026\u0026 \\\n    echo \"    proto: http\" \u003e\u003e /home/developer/.ngrok2/ngrok.yml \u0026\u0026 \\\n    echo \"    addr: 3000\" \u003e\u003e /home/developer/.ngrok2/ngrok.yml \u0026\u0026 \\\n    chown -R developer:docker /home/developer/.ngrok2\n\nUSER developer\nWORKDIR /home/developer\nCMD [ \"ttyd\", \"-c\", \"developer:password\", \"-s\", \"3\", \"-t\", \"titleFixed=/bin/sh\", \"-t\", \"rendererType=webgl\", \"-t\", \"disableLeaveAlert=true\", \"/bin/sh\", \"-i\", \"-l\" ]\n``` \nBuild, then run it:\n ```sh\n# docker build . -t js-box\n# docker run --rm --hostname jsbox -d -p 7681:7681 js-box\n```\nBecause we configured the **~/.ngrok2/ngrok.yml** on this custom image, you can start the ngrok tunnel by name inside the container as follows:\n ```sh\n# ngrok start nodejs\n```\n\nAnd since this image has the docker-cli, you could even bind-mount the host docker socket to use it from inside the container: \n ```sh\n# docker run --rm --hostname jsbox -v /var/run/docker.sock:/var/run/docker.sock -d -p 7681:7681 js-box\n```\nWe could also use have used socat, openssh tunnels or event ngrok to forward the local docker port (2375) to another host.\n\n---\n## ngrok account and plans\nngrok suports TLS, TCP tunnels, certs, built-in fileserver, forwarding to other machines so please take a look on https://ngrok.com/docs for more help.\n\nKeep in mind that some of the advanced features require you to create a (free) account then use the provided auth token. See https://ngrok.com/docs#getting-started-authtoken for more info.\n\nngrok is free but also has paid plans that allow custom domains, reserved tunnels and greater control. See https://ngrok.com/pricing for plans.\n\n---\n## Licenses\n\n[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n---\n## Disclaimer\n* I am not affiliated in any way with ngrok.\n* This image comes with no warranty. Use it at your own risk.\n* I don't like Apple. Fuck off, fan-boys.\n* I don't like left-winged snowflakes. Fuck off, code-covenant. \n* I will call my branches the old way. Long live **master**, fuck-off renaming.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraonigabriel%2Fweb-terminal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraonigabriel%2Fweb-terminal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraonigabriel%2Fweb-terminal/lists"}