Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No stack trace resulting in ContainerError when tty is enabled #2260

Open
damienrj opened this issue Feb 21, 2019 · 2 comments
Open

No stack trace resulting in ContainerError when tty is enabled #2260

damienrj opened this issue Feb 21, 2019 · 2 comments
Labels

Comments

@damienrj
Copy link

I am having an issue where I don't get the error responsible for the ContainerError unless I turn off tty. Is the expected behavior?

With tty enabled:

ContainerError: Command '['train']' in image 'conductor:latest' returned non-zero exit status 1:

With tty disabled:

ContainerError: Command '['train']' in image 'conductor:latest' returned non-zero exit status 1: Traceback (most recent call last):
...
long stack trace
...
    raise ValueError('Config not specified')
ValueError: Config not specified
@jcsirot
Copy link
Contributor

jcsirot commented Feb 25, 2019

Thank you for your report @damienrj
Please could you provided a short code snippet triggering the issue.

@damienrj
Copy link
Author

@jcsirot Sure
Dockerfile:

FROM python:2.7.15-slim-jessie
RUN touch script.py
RUN echo "raise Exception('test')" >> script.py
ENTRYPOINT [ "python" ]

Code:

import docker
client = docker.from_env()
client.containers.run('test:latest', command='script.py', tty=True, stderr=True, stdout=True)

Only see the ContainerError

In [19]: import docker
    ...: client = docker.from_env()
    ...: client.containers.run('test:latest', command='script.py', tty=True, stderr=True, stdout=True)
    ...:
---------------------------------------------------------------------------
ContainerError                            Traceback (most recent call last)
<ipython-input-19-b88d242687dc> in <module>()
      1 import docker
      2 client = docker.from_env()
----> 3 client.containers.run('test:latest', command='script.py', tty=True, stderr=True, stdout=True)

/usr/local/lib/python2.7/site-packages/docker/models/containers.pyc in run(self, image, command, stdout, stderr, remove, **kwargs)
    812         if exit_status != 0:
    813             raise ContainerError(
--> 814                 container, exit_status, command, image, out
    815             )
    816

ContainerError: Command 'script.py' in image 'test:latest' returned non-zero exit status 1:
import docker
client = docker.from_env()
client.containers.run('test:latest', command='script.py', tty=False, stderr=True, stdout=True)

Can see the Exception: test

In [21]: import docker
    ...: client = docker.from_env()
    ...: client.containers.run('test:latest', command='script.py', tty=False, stderr=True, stdout=True)
    ...:
---------------------------------------------------------------------------
ContainerError                            Traceback (most recent call last)
<ipython-input-21-38e8d31dafd3> in <module>()
      1 import docker
      2 client = docker.from_env()
----> 3 client.containers.run('test:latest', command='script.py', tty=False, stderr=True, stdout=True)

/usr/local/lib/python2.7/site-packages/docker/models/containers.pyc in run(self, image, command, stdout, stderr, remove, **kwargs)
    812         if exit_status != 0:
    813             raise ContainerError(
--> 814                 container, exit_status, command, image, out
    815             )
    816

ContainerError: Command 'script.py' in image 'test:latest' returned non-zero exit status 1: Traceback (most recent call last):
  File "script.py", line 1, in <module>
    raise Exception('test')
Exception: test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants