Larry Martell
Larry Martell

Reputation: 3756

starting docker container from python messes up terminal settings

I am starting a docker container from a subprocess.Popen and it works, but when the script returns, the terminal settings of my shell are messed up. Nothing is echoed. I can fix this with tset in the terminal, but I don't want to require that. Has anyone here worked with docker and had seen and solved this issue?

Here is how I am starting the container:

        cmd = ['sudo',
               'docker',
               'run',
               '-t',
               '-i',
               'elucidbio/capdata:v2',
               'bash'
        ]
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

I have tried replacing the bash with an infinite loop and using nohup, but the same thing happened.

Upvotes: 4

Views: 526

Answers (1)

Larry Martell
Larry Martell

Reputation: 3756

I fixed this by removing -t and passing in stdin=None. This was suggested by J.F. Sebastian in a comment, and he did not want to post it as an answer, so I am.

Upvotes: 4

Related Questions