john-mueller
john-mueller

Reputation: 117

Docker start does not provide print output on the console

If you build a container in docker from an image and start it with "docker run", my python script will run as usual and will also deliver the desired prints to the console. But if I now start the same container with "docker start" again, I don't get any print outputs on the console.

So is it always necessary to build a new container from the image or am I currently missing one?

In the following I provide you with a short test python script:

import numpy as np
import sys
from absl import app, flags
from absl.flags import FLAGS

import include_files
from external_modules import external

flags.DEFINE_string("pa", "standard", "Testing")

def main(_argv):

    print("Python Version:")
    print(sys.version)

    print("Numpy Version:")
    print(np.version.version)

    print("hello world!")

    include_files._druck()
    external._druck()

    print(FLAGS.pa)


if __name__ == '__main__':
    try:
        app.run(main)
    except SystemExit:
        pass

Upvotes: 1

Views: 2319

Answers (1)

Aramakus
Aramakus

Reputation: 1920

This is most likely because you did not tell it to start in interactive session, so try docker start -i. Otherwise, you script may not be starting automatically when you run this command.

Upvotes: 2

Related Questions