# docker-exec-web-console **Repository Path**: linqingping/docker-exec-web-console ## Basic Information - **Project Name**: docker-exec-web-console - **Description**: A web UI to docker exec from the browser - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-02 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # `docker exec` web console This image is originally inspirated by [this gist](https://gist.github.com/Humerus/0268c62f359f7ee1ee2d). The container use `socat` to bound Docker socket to a TCP port, so that I could avoid to change the `http.Post` part in the Go server to talk directly to a UNIX socket. You can launch the container in this way: ``` docker run -id \ --name docker-exec-web-console \ -p 9999:8888 \ -e "CONTEXT_PATH=/"\ -v /var/run/docker.sock:/var/run/docker.sock \ bitbull/docker-exec-web-console ``` 不加-e "CONTEXT_PATH=/" 出现重定向失败 Then you can reach the console at the url `http://localhost:9999` It's possible to pass a context path to which the container will responds, using `CONTEXT_PATH` environment variable: ``` docker run -id \ --name docker-exec-web-console \ -p 9999:8888 \ -e "CONTEXT_PATH=/webconsole" \ -v /var/run/docker.sock:/var/run/docker.sock \ bitbull/docker-exec-web-console ``` With the above example, the console will be reachable at the url `http://localhost:9999/webconsole` You can select the container to exec into passing its id directly via `cid` querystring parameter ( eg. `http://localhost:9999?cid=` ) or in the prompt that will show at page load. You can pass the command to execute passing it via `cmd` querystring parameter ( eg. `http://localhost:9999?cid=&cmd=/bin/sh` ), otherwise it default to `/bin/bash`. ## Build the image The image is based on `alpine:latest`, so you need to compile the server for Linux with all libs statically linked: ``` CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . ``` then you can build as usual: ``` docker build -t bitbull/docker-exec-web-console . ```