<p>I have simple python 2.7 program running in container off Kubernetes (AKS) which is printing debug information to standard output</p>

<pre><code>response = requests.post(uri,data=body, headers=headers)
if (response.status_code &gt;= 200 and response.status_code &lt;= 299):
    print 'Accepted ' + log_type + ' on ' + rfc1123date
else:
    print "Response code: {}".format(response.status_code)
</code></pre>

<p>I don't see it with <code>kubectl logs container_name</code>, output is empty (but I know it is fine because of successful post). I tried to add <code>"-u"</code> to <code>CMD ["-u","syslog2la.py"]</code> in Dockerfile, but it didn't help. How to get the python print in '<em>kubectl logs</em>'?</p>

<p>Add the following to your Dockerfile:</p>

<pre><code>ENV PYTHONUNBUFFERED=0
</code></pre>
