title: Set environemnt variables on Dockerfile, flask server not working
body: <p>I need to set the environment in my Dockerfile (I can't use docker-compose because I will need this dockerfile for kubernetes).
  Here is my Dockerfile:</p>
  
  <pre><code>FROM tensorflow/tensorflow:2.1.0-py3
  
  RUN apt -qq -y update \
      &amp;&amp; apt -qq -y upgrade
  
  WORKDIR /socialworks-api
  COPY . /socialworks-api
  
  RUN python -m pip install --upgrade pip
  
  RUN apt -y install git
  
  #for mysql
  RUN apt install -y libmysqlclient-dev
  
  RUN pip --no-cache-dir install -r requirements.txt
  EXPOSE 5000
  CMD ["/bin/bash", "./start.sh"]
  </code></pre>
  
  <p>Here is my start.sh file:</p>
  
  <pre><code>#!/bin/bash
  export $(grep -v '^#' env/docker.env | xargs)
  source env/docker.env
  python app.py
  </code></pre>
  
  <p>Here is where I start my flask server in app.py:</p>
  
  <pre><code>if __name__ == '__main__':
      print("test")
      socketio.run(app, host="0.0.0.0", debug=True, use_reloader=False)
  </code></pre>
  
  <p>The issue is that after these commands, I try to run my docker container and the flask server is being launched (it even prints test in the terminal) and when I try to run <a href="http://0.0.0.0:5000/" rel="nofollow noreferrer">http://0.0.0.0:5000/</a> I am having unable to connect issue on the browser.
  Maybe the issue is with CMD in my dockerfile or start.sh file? I am new to Docker. Any help will be appreciated. Locally everything works fine.
  Here is the command I use to run the docker container: </p>
  
  <pre><code>docker run -it flaskapp
  </code></pre>
  
  <p>Here is the docker ps:</p>
  
  <pre><code>CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
  337f1bdacb3e        flaskapp            "/bin/bash ./start.sh"   44 seconds ago      Up 42 seconds       5000/tcp            dazzling_mcclintock
  </code></pre>
  
  <p>Here are the logs:</p>
  
  <pre><code>docker logs 337f1bdacb3e
  [nltk_data] Downloading package punkt to /root/nltk_data...
  [nltk_data]   Unzipping tokenizers/punkt.zip.
  2020-04-20 10:02:44.287504: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
  2020-04-20 10:02:44.309581: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2394225000 Hz
  2020-04-20 10:02:44.310031: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4971910 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
  2020-04-20 10:02:44.310068: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
  test
  (10) wsgi starting up on http://0.0.0.0:5000
  </code></pre>
  
  <p>Logs are the same what I get when running it locally and locally everything works. Could it be that the flask application is being stopped somehow when running it?</p>