Coder Social home page Coder Social logo

wrfly / container-web-tty Goto Github PK

View Code? Open in Web Editor NEW
235.0 9.0 46.0 3.82 MB

Connect your containers via a web-tty

Home Page: https://container-web-tty.kfd.me/

License: Apache License 2.0

Go 97.32% Makefile 0.30% TypeScript 1.36% JavaScript 0.22% CSS 0.42% HTML 0.38% Dockerfile 0.01%
docker tty web-tty containers terminal web-terminal

container-web-tty's People

Contributors

dependabot[bot] avatar huapox avatar rikaaa0928 avatar whatever4711 avatar wrfly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

container-web-tty's Issues

Dockerfile no longer building

The current Dockerfile started failing to build on 11/12/2022. Here is the build output:

latest: Pulling from plugins/docker
Digest: sha256:f200f24958d969e4b819a2d7564b45a519b2ffa8823fbc829fde06544e90a198
Status: Image is up to date for plugins/docker:latest
+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry ******
Registry credentials or Docker config not provided. Guest mode enabled.
+ /usr/local/bin/docker version
Client:
 Version:           20.10.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:45:09 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.14
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       87a90dc
  Built:            Thu Mar 24 01:49:54 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.11
  GitCommit:        3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
+ /usr/local/bin/docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-1031-azure
 Operating System: Alpine Linux v3.15
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.12GiB
 Name: 58bab363bf2f
 ID: JY52:KJYW:TXFX:PD7Y:5F5E:GCVQ:GAVI:VDBM:EIVW:FCIW:T6F2:NTL3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  ******
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

+ /usr/local/bin/docker build --rm=true -f /drone/src/Dockerfile -t 27082a50dd03ce0e3d1afd92390ea2aa624e40f5 . --pull=true --label org.opencontainers.image.created=2023-01-20T07:03:36Z --label org.opencontainers.image.revision=27082a50dd03ce0e3d1afd92390ea2aa624e40f5 --label org.opencontainers.image.source=http://osu.gitea:3069/osuhickeys/container-web-tty.git --label org.opencontainers.image.url=http://osu.gitea:3069/osuhickeys/container-web-tty
Sending build context to Docker daemon  42.67MB

Step 1/9 : FROM alpine
latest: Pulling from library/alpine
8921db27df28: Pulling fs layer
8921db27df28: Verifying Checksum
8921db27df28: Download complete
8921db27df28: Pull complete
Digest: sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a
Status: Downloaded newer image for alpine:latest
 ---> 042a816809aa
Step 2/9 : RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
 ---> Running in 74f4b94c7ae6
The command '/bin/sh -c [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf' returned a non-zero code: 1
exit status 1

[bug] didn't reconnect the docker socket

when docker is restarted, should reconnect the docker sock, since there are maybe a "live-restore" config, so that the process will not stop when restarting the docker daemon.

[feature request] tail logs online

for some reasons we cannot exec docker or the exec it not convenient, so we want to tail container logs via the browser, arguments available.

docker cli watch events error

docker cli watch events error: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.42

not work (((

k3s下可读取到容器列表,但连接TTY会失败

  • k3s 1.17.4
[root@vm23-198 k3s]# docker logs -f --tail=30 43f654475d35
INFO[0000] New kube client: host [https://127.0.0.1:6443], namespaces [default,kube-system,kube-public,kube-node-lease] 
INFO[0000] Server running at http://0.0.0.0:8080        
ERRO[0012] cannot find a valid shell in container []    
ERRO[0018] cannot find a valid shell in container []    
ERRO[0023] cannot find a valid shell in container []    
ERRO[0026] cannot find a valid shell in container []

Disable terminals

Hello, is there any way to disable the terminals and only provide the logs?

backend get sh

// cat /etc/shells` and chose one
GetShell(containerID string) string

k3s下查看容器日志,换行格式混乱

2021-03-08_171857

[root@(⎈ |default:kube-web) /]$ kc logs -f --tail=20 goldpinger-vssjq
{"level":"info","ts":1615175439.9033206,"caller":"goldpinger/pinger.go:159","msg":"Starting pinger","op":"pinger","name":"goldpinger-vssjq","hostIP":"3.4.5.2","podIP":"","period":30,"initialWait":15,"jitterFactor":0.05}
{"level":"warn","ts":1615175439.9035208,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-mrx67","hostIP":"3.4.5.2","podIP":"10.42.0.9","responseTime":0.000411561,"error":"Get \"http://10.42.0.9:80/ping\": dial tcp 10.42.0.9:80: connect: no route to host"}
{"level":"warn","ts":1615175447.7036345,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-4wr78","hostIP":"3.4.5.3","podIP":"10.42.1.6","responseTime":0.300109295,"error":"Get \"http://10.42.1.6:80/ping\": context deadline exceeded"}
{"level":"warn","ts":1615175454.9034328,"caller":"goldpinger/pinger.go:84","msg":"Could not get client","op":"pinger","name":"goldpinger-vssjq","hostIP":"3.4.5.2","podIP":"","error":"Host or pod IP empty, can't make a call"}
{"level":"warn","ts":1615175462.40329,"caller":"goldpinger/pinger.go:84","msg":"Could not get client","op":"pinger","name":"goldpinger-tqwqg","hostIP":"3.4.5.3","podIP":"","error":"Host or pod IP empty, can't make a call"}
{"level":"info","ts":1615175469.9066997,"caller":"goldpinger/updater.go:128","msg":"Deleting pod from pingers","name":"goldpinger-vssjq","podIP":"","hostIP":"3.4.5.2"}
{"level":"info","ts":1615175469.9067352,"caller":"goldpinger/updater.go:128","msg":"Deleting pod from pingers","name":"goldpinger-tqwqg","podIP":"","hostIP":"3.4.5.3"}
{"level":"info","ts":1615175469.9067416,"caller":"goldpinger/updater.go:107","msg":"Starting pingers for new pods","numNewPods":2,"refreshPeriod":30,"waitPeriod":15,"JitterFactor":0.05}
{"level":"info","ts":1615175469.906774,"caller":"goldpinger/pinger.go:159","msg":"Starting pinger","op":"pinger","name":"goldpinger-tqwqg","hostIP":"3.4.5.3","podIP":"10.42.3.3","period":30,"initialWait":15,"jitterFactor":0.05}
{"level":"info","ts":1615175469.9067938,"caller":"goldpinger/pinger.go:159","msg":"Starting pinger","op":"pinger","name":"goldpinger-vssjq","hostIP":"3.4.5.2","podIP":"10.42.2.3","period":30,"initialWait":0,"jitterFactor":0.05}
{"level":"warn","ts":1615175470.8107235,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-mrx67","hostIP":"3.4.5.2","podIP":"10.42.0.9","responseTime":0.000450583,"error":"Get \"http://10.42.0.9:80/ping\": dial tcp 10.42.0.9:80: connect: no route to host"}
{"level":"warn","ts":1615175479.114571,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-4wr78","hostIP":"3.4.5.3","podIP":"10.42.1.6","responseTime":0.300135316,"error":"Get \"http://10.42.1.6:80/ping\": dial tcp 10.42.1.6:80: i/o timeout"}
{"level":"warn","ts":1615175501.840936,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-mrx67","hostIP":"3.4.5.2","podIP":"10.42.0.9","responseTime":0.000343806,"error":"Get \"http://10.42.0.9:80/ping\": dial tcp 10.42.0.9:80: connect: no route to host"}
{"level":"warn","ts":1615175509.2131298,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-4wr78","hostIP":"3.4.5.3","podIP":"10.42.1.6","responseTime":0.300135966,"error":"Get \"http://10.42.1.6:80/ping\": dial tcp 10.42.1.6:80: i/o timeout"}
{"level":"warn","ts":1615175532.292389,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-mrx67","hostIP":"3.4.5.2","podIP":"10.42.0.9","responseTime":0.000330327,"error":"Get \"http://10.42.0.9:80/ping\": dial tcp 10.42.0.9:80: connect: no route to host"}
{"level":"warn","ts":1615175539.9861126,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-4wr78","hostIP":"3.4.5.3","podIP":"10.42.1.6","responseTime":0.300149933,"error":"Get \"http://10.42.1.6:80/ping\": context deadline exceeded"}
{"level":"warn","ts":1615175563.1632693,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-mrx67","hostIP":"3.4.5.2","podIP":"10.42.0.9","responseTime":0.300122017,"error":"Get \"http://10.42.0.9:80/ping\": context deadline exceeded"}
{"level":"warn","ts":1615175570.4632773,"caller":"goldpinger/pinger.go:151","msg":"Ping returned error","op":"pinger","name":"goldpinger-4wr78","hostIP":"3.4.5.3","podIP":"10.42.1.6","responseTime":0.300147665,"error":"Get \"http://10.42.1.6:80/ping\": context deadline exceeded"}
{"level":"info","ts":1615175589.932876,"caller":"goldpinger/updater.go:128","msg":"Deleting pod from pingers","name":"goldpinger-mrx67","podIP":"10.42.0.9","hostIP":"3.4.5.2"}
{"level":"info","ts":1615175589.9329145,"caller":"goldpinger/updater.go:128","msg":"Deleting pod from pingers","name":"goldpinger-4wr78","podIP":"10.42.1.6","hostIP":"3.4.5.3"}

Lost connection to docker socket

After the recent update on 25/9, the container lost connection to the docker sock. I tried using the volume mount and the proxy socket, but none worked.
Previously, I used to have it running using the socket proxy

Below is the docker-compose and log using the volume mounting /var/run/docker.sock

docker-compose

  webtty:
    container_name: container-webtty
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 8818:8080
    image: 'wrfly/container-web-tty:latest'

LOGS

ime="2023-10-01T09:43:54Z" level=info msg="Docker connecting to unix:///var/run/docker.sock"
time="2023-10-01T09:43:54Z" level=info msg="New docker client: API [1.41]"
time="2023-10-01T09:43:54Z" level=info msg="Warm up containers info..."
time="2023-10-01T09:43:54Z" level=info msg="Server running at http://0.0.0.0:8080/"
time="2023-10-01T09:43:54Z" level=error msg="list containers eror: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.41"
time="2023-10-01T09:43:54Z" level=error msg="docker cli watch events error: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.41"
time="2023-10-01T09:43:54Z" level=fatal msg="lost connection to docker daemon"
time="2023-10-01T09:43:59Z" level=info msg="Docker connecting to unix:///var/run/docker.sock"
time="2023-10-01T09:43:59Z" level=info msg="New docker client: API [1.41]"
time="2023-10-01T09:43:59Z" level=info msg="Warm up containers info..."
time="2023-10-01T09:43:59Z" level=info msg="Server running at http://0.0.0.0:8080/"
time="2023-10-01T09:43:59Z" level=error msg="list containers eror: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.41"
time="2023-10-01T09:43:59Z" level=error msg="docker cli watch events error: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.41"
time="2023-10-01T09:43:59Z" level=fatal msg="lost connection to docker daemon"
time="2023-10-01T09:44:02Z" level=info msg="Docker connecting to unix:///var/run/docker.sock"
time="2023-10-01T09:44:02Z" level=info msg="New docker client: API [1.41]"

Below is the docker-compose and log using the socket proxy connection, which has been working fine for more than a year, until the latest update on 25/9

docker-compose

  webtty:
    container_name: container-webtty
    restart: unless-stopped
    environment:
      - DOCKER_HOST=192.168.1.10:2375
    ports:
      - 8818:8080
    image: 'wrfly/container-web-tty:latest'

LOGS

time="2023-10-01T10:53:45Z" level=info msg="Docker connecting to tcp://192.168.1.10:2375"
time="2023-10-01T10:53:45Z" level=error msg="create new docker client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:45Z" level=fatal msg="Create backend client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:49Z" level=info msg="Docker connecting to tcp://192.168.1.10:2375"
time="2023-10-01T10:53:49Z" level=error msg="create new docker client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:49Z" level=fatal msg="Create backend client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:52Z" level=info msg="Docker connecting to tcp://192.168.1.10:2375"
time="2023-10-01T10:53:52Z" level=error msg="create new docker client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:52Z" level=fatal msg="Create backend client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:56Z" level=info msg="Docker connecting to tcp://192.168.1.10:2375"
time="2023-10-01T10:53:56Z" level=error msg="create new docker client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:56Z" level=fatal msg="Create backend client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:59Z" level=info msg="Docker connecting to tcp://192.168.1.10:2375"
time="2023-10-01T10:53:59Z" level=error msg="create new docker client error: unable to parse docker host `192.168.1.10:2375`"
time="2023-10-01T10:53:59Z" level=fatal msg="Create backend client error: unable to parse docker host `192.168.1.10:2375`"

[bug] mess logs

13=\r
10=\n

some logs only have \n, need to insert a \r

{"log":"[2018-09-18T01:28:00,006][INFO ][o.e.x.m.MlDailyMaintenanceService] Successfully completed [ML] maintenance tasks\r\n","stream":"stdout","time":"2018-09-18T01:28:00.006751949Z"}

{"log":"time=\"2018-09-18T03:36:30Z\" level=info msg=\"Warm up containers info...\"\n","stream":"stderr","time":"2018-09-18T03:36:30.82042848Z"}

URL Base

Is there a URL base option for putting behind a proxy server as a subdirectory?

behind proxy configuration

i want use nginx to proxy this webserver, like this:
proxy /env1 127.0.0.1:8080

this will have a lot of 404 page not found

Upgrade dependency "github.com/gin-gonic/gin"

Background

Repo github.com/wrfly/container-web-tty depends on github.com/gin-gonic/[email protected].

https://github.com/wrfly/container-web-tty/blob/master/go.mod#L10

However, comparing version v1.7.3 of github.com/gin-gonic/gin from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
      "name": "Bo-Yi Wu",
      "email": "[email protected]",
      "date": "2021-08-03T02:40:44Z"
    }

commit time of the copy on proxy.golang.org

"Version":"v1.7.3","Time":"2021-08-03T02:36:43Z"}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v1.7.3 tag of github.com/gin-gonic/gin might have been retagged after a minor edition on github. I guess you use proxy.golang.org to get dependencies, but that also shows that your project is depending on the copy of github.com/gin-gonic/[email protected] before its edition. Depending upon such inconsistent tag version may also result in some unexpected errors as well as build errors due to different proxy settings.

For example, when someone who does not use proxy.golang.org, say GOPROXY=direct, attempts to get github.com/gin-gonic/[email protected], the following error occurs.

go: downloading github.com/gin-gonic/gin v1.7.3
go: github.com/gin-gonic/gin@v1.7.3: verifying module: checksum mismatch
        downloaded: h1:3U500Wp728rATEiFJtk1L7dhAbWobNDQC0Cbd4yhhdc=
        sum.golang.org: h1:aMBzLJ/GMEYmv1UWs2FFTcPISLrQH2mRgL9Glz8xows=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

So, this is a reminder in the hope that you can get rid of this problematic version of project github.com/gin-gonic/gin.

Solution

1. Bump the version of dependency github.com/gin-gonic/gin

I would recommend bumping the version of github.com/gin-gonic/gin to a new release to ensure dependency copy in proxy.golang.org and github in sync.

References

Question about CMD

Hello,

I have some kind of project on mind which i'm thinking to run under docker containers,

So i also need to provide to my users access via console(tty), so randomly found this project and it looks interesting, however (since i can't install this atm) i have a question

How does this attach console into the browser my question exactly is example if we start a docker container with a cmd to run some app, apache nginx or whatever when you do docker exec -it container1 bash you'll see the running appoutput (output of nginx or apache)
so what output will container-web-tty display?
the same as docker exec -it... or nothing like you just connect via ssh to a server with a new session?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.