<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">App run with debug mode raise OSError</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="app = make_app()
celery = make_celery(app)
KafkaProducerExt(app)
if __name__ == &quot;__main__&quot;:
    app.run(debug=True)
"><pre class="notranslate"><span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-en">make_app</span>()
<span class="pl-s1">celery</span> <span class="pl-c1">=</span> <span class="pl-en">make_celery</span>(<span class="pl-s1">app</span>)
<span class="pl-v">KafkaProducerExt</span>(<span class="pl-s1">app</span>)
<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">"__main__"</span>:
    <span class="pl-s1">app</span>.<span class="pl-en">run</span>(<span class="pl-s1">debug</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">App run with debug mode raise OSError, when i change debug to False, everything ok</p>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File &quot;app/app.py&quot;, line 8, in &lt;module&gt;
    app.run(debug=True)
  File &quot;/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/flask/app.py&quot;, line 943, in run
    run_simple(host, port, self, **options)
  File &quot;/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/serving.py&quot;, line 988, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File &quot;/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py&quot;, line 332, in run_with_reloader
    sys.exit(reloader.restart_with_reloader())
  File &quot;/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py&quot;, line 176, in restart_with_reloader
    exit_code = subprocess.call(args, env=new_environ, close_fds=False)
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 947, in __init__
    restore_signals, start_new_session)
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
"><pre class="notranslate"> * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File <span class="pl-s">"app/app.py"</span>, line <span class="pl-c1">8</span>, in <span class="pl-en">&lt;module&gt;</span>
    app.run(<span class="pl-v">debug</span><span class="pl-k">=</span><span class="pl-c1">True</span>)
  File <span class="pl-s">"/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/flask/app.py"</span>, line <span class="pl-c1">943</span>, in <span class="pl-en">run</span>
    run_simple(host, port, <span class="pl-c1">self</span>, <span class="pl-k">**</span>options)
  File <span class="pl-s">"/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/serving.py"</span>, line <span class="pl-c1">988</span>, in <span class="pl-en">run_simple</span>
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File <span class="pl-s">"/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py"</span>, line <span class="pl-c1">332</span>, in <span class="pl-en">run_with_reloader</span>
    sys.exit(reloader.restart_with_reloader())
  File <span class="pl-s">"/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py"</span>, line <span class="pl-c1">176</span>, in <span class="pl-en">restart_with_reloader</span>
    exit_code <span class="pl-k">=</span> subprocess.call(args, <span class="pl-v">env</span><span class="pl-k">=</span>new_environ, <span class="pl-v">close_fds</span><span class="pl-k">=</span><span class="pl-c1">False</span>)
  File <span class="pl-s">"/usr/lib/python3.5/subprocess.py"</span>, line <span class="pl-c1">557</span>, in <span class="pl-en">call</span>
    <span class="pl-k">with</span> Popen(<span class="pl-k">*</span>popenargs, <span class="pl-k">**</span>kwargs) <span class="pl-k">as</span> p:
  File <span class="pl-s">"/usr/lib/python3.5/subprocess.py"</span>, line <span class="pl-c1">947</span>, in <span class="pl-en">__init__</span>
    restore_signals, start_new_session)
  File <span class="pl-s">"/usr/lib/python3.5/subprocess.py"</span>, line <span class="pl-c1">1551</span>, in <span class="pl-en">_execute_child</span>
    <span class="pl-k">raise</span> child_exception_type(errno_num, err_msg)
<span class="pl-en">OSError</span>: <span class="pl-s">[Errno 8] Exec format error</span>
</pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Python version: Python 3.5.2</li>
<li>Flask version:1.0.2</li>
<li>Werkzeug version:0.15.1</li>
</ul>
<p dir="auto">The new 0.15.0 does not run in Docker for Windows. Have not tried Docker on other platforms.</p>
<p dir="auto">Minimal example with Flask.</p>
<p dir="auto">app.py</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from flask import Flask
 
app = Flask(__name__)
 
 
@app.route('/')
def hello_world():
    return 'Hello, world!'
 
if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')"><pre class="notranslate"><code class="notranslate">from flask import Flask
 
app = Flask(__name__)
 
 
@app.route('/')
def hello_world():
    return 'Hello, world!'
 
if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')
</code></pre></div>
<p dir="auto">Dockerfile</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FROM python:3-onbuild
COPY . /usr/src/app
CMD [&quot;python&quot;, &quot;app.py&quot;]"><pre class="notranslate"><code class="notranslate">FROM python:3-onbuild
COPY . /usr/src/app
CMD ["python", "app.py"]
</code></pre></div>
<p dir="auto">requirements.txt</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# Werkzeug==0.14.1
Flask"><pre class="notranslate"><code class="notranslate"># Werkzeug==0.14.1
Flask
</code></pre></div>
<p dir="auto">Run <code class="notranslate">docker build -t flask_test .</code> and then <code class="notranslate">docker run flask_test</code>.<br>
Error in container:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="λ docker run flask_test
 * Serving Flask app &quot;app&quot; (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File &quot;app.py&quot;, line 11, in &lt;module&gt;
    app.run(debug=True, host='0.0.0.0')
  File &quot;/usr/local/lib/python3.6/site-packages/flask/app.py&quot;, line 943, in run
    run_simple(host, port, self, **options)
  File &quot;/usr/local/lib/python3.6/site-packages/werkzeug/serving.py&quot;, line 988, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File &quot;/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py&quot;, line 332, in run_with_reloader
    sys.exit(reloader.restart_with_reloader())
  File &quot;/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py&quot;, line 176, in restart_with_reloader
    exit_code = subprocess.call(args, env=new_environ, close_fds=False)
  File &quot;/usr/local/lib/python3.6/subprocess.py&quot;, line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File &quot;/usr/local/lib/python3.6/subprocess.py&quot;, line 709, in __init__
    restore_signals, start_new_session)
  File &quot;/usr/local/lib/python3.6/subprocess.py&quot;, line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/src/app/app.py"><pre class="notranslate"><code class="notranslate">λ docker run flask_test
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File "app.py", line 11, in &lt;module&gt;
    app.run(debug=True, host='0.0.0.0')
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 943, in run
    run_simple(host, port, self, **options)
  File "/usr/local/lib/python3.6/site-packages/werkzeug/serving.py", line 988, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File "/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
    sys.exit(reloader.restart_with_reloader())
  File "/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
    exit_code = subprocess.call(args, env=new_environ, close_fds=False)
  File "/usr/local/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/src/app/app.py
</code></pre></div>
<p dir="auto">Uncomment the first line in <code class="notranslate">requirements.txt</code> and it runs properly after rebuild.</p>