How to connect to docker container from shell_command
nikhilkabbin opened this issue · 2 comments
nikhilkabbin commented
I am trying to run a docker image from shell_command
but getting an error
martinzugnoni commented
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?
simonMoisselin commented
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)