supereagle / experiences

Summary of practical experience in work.
2 stars 0 forks source link

Remotely login and exec command in container through websocket #23

Closed supereagle closed 7 years ago

supereagle commented 7 years ago

On Docker host, we can run docker exec -it ${CONTAINER_ID/CONTAINER_NAME} ${COMMAND} to login and exec command in containers.

On Kubernetes master, we can run kubectl exec -it ${POD_NAME} ${COMMAND} to login and exec command in the container of the pod. If there are multiple containers of the pod, can run the command in specified container.

Both of these two ways are inconvenient and unsecured, as they need to login the Docker host or Kubernetes master, and have the permission to run some other dangerous commands.

A better way is to login and run command in container through websocket.

Reference

supereagle commented 7 years ago

I have implemented this feature in the open project DockerTTY, which is based on the work of GoTTY.