terminado icon indicating copy to clipboard operation
terminado copied to clipboard

How to connect to docker container from shell_command

Open nikhilkabbin opened this issue 6 years ago • 2 comments

I am trying to run a docker image from shell_command but getting an error

nikhilkabbin avatar May 09 '19 04:05 nikhilkabbin

Any update on how to spawn the shell command inside a docker container? Particularly in my user case I would like to run a separated ipython kernel for each instance of xterm websocket connection. Is it possible in this way?

martinzugnoni avatar Nov 13 '19 23:11 martinzugnoni

Somehow, if I run the docker command as a list like this shell_command=["docker", "run", "-it", "--rm", "python:3.5-slim-buster"] instead of shell_command=["docker run -it --rm python:3.5-slim-buster"] , the error is not present anymore.

I think version 1 is easier to serialize. The error is coming from the library ptyprocess , and we can experiment using this code:

from ptyprocess import PtyProcessUnicode
pty = PtyProcessUnicode.spawn(["docker", "run", "-it","--rm", "python:3.5-slim-buster"])
pty.read(1000)

simonMoisselin avatar Feb 29 '20 19:02 simonMoisselin