title: Azure Container generates error '503' reason 'site unavailable'
body: <h1>The issue</h1>
  <p>I have built a docker image on my local machine running windows 10</p>
  <ol>
  <li><p>running <code>docker-compose build</code>, <code>docker-compose up -d</code>and <code>docker-compse logs -f</code> do generate expected results (no error)</p>
  </li>
  <li><p>the app runs correctly by running <code>winpty docker container run -i -t -p 8000:8000 --rm altf1be.plotly.docker-compose:2019-12-17</code></p>
  </li>
  <li><p>I upload the docker image on a private Azure Container Registry</p>
  </li>
  <li><p>I deploy the web app based on the docker image <code>Azure Portal &gt; Container registry &gt; Repositories &gt; altf1be.plotly.docker-compose &gt; v2019-12-17 &gt; context-menu &gt; deploy to web app</code></p>
  </li>
  </ol>
  <p><a href="https://i.stack.imgur.com/3jA8q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3jA8q.png" alt="Azure - Deploy the web app from a docker image" /></a></p>
  <ol start="5">
  <li>I run the web app and I get <code>The service is unavailable</code></li>
  </ol>
  <p><strong>what is wrong with my method?</strong></p>
  <p>Thank you in advance for the time you will invest on this issue</p>
  <h1>docker-compose.yml</h1>
  <pre><code>version: '3.7'
  services:
    twikey-plot_ly_service:
      # container_name: altf1be.plotly.docker-container-name
      build: .
      image: altf1be.plotly.docker-compose:2019-12-17
      command: gunicorn --config=app/conf/gunicorn.conf.docker.staging.py app.webapp:server
      ports:
        - 8000:8000
      env_file: .env.staging
  
  </code></pre>
  <h1>.env/staging</h1>
  <pre><code>apiUrl=https://api.beta.alt-f1.be
  authorizationUrl=/api/auth/authorization/code
  serverUrl=https://dunningcashflow-api.alt-f1.be
  transactionFeedUrl=/creditor/tx
  api_token=ANICETOKEN
  
  </code></pre>
  <h1>Dockerfile</h1>
  <pre><code># read the Dockerfile reference documentation
  # https://docs.docker.com/engine/reference/builder
  
  # build the docker
  # docker build -t altf1be.plotly.docker-compose:2019-12-17.
  
  # https://docs.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image#use-a-docker-image-from-any-private-registry-optional
  
  # Use the docker images used by Microsoft on Azure
  
  FROM mcr.microsoft.com/oryx/python:3.7-20190712.5
  LABEL Name=altf1.be/plotly Version=1.19.0
  LABEL maintainer=&quot;abo+plotly_docker_staging@alt-f1.be&quot;
  RUN mkdir /code
  WORKDIR /code
  ADD requirements.txt /code/
  # copy the code from the local drive to the docker
  ADD . /code/
  
  # non interactive front-end
  ARG DEBIAN_FRONTEND=noninteractive
  
  # update the software repository
  ENV SSH_PASSWD 'root:!astrongpassword!'
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      apt-utils \
      # enable SSH
      &amp;&amp; apt-get install -y --no-install-recommends openssh-server \
      &amp;&amp; echo &quot;$SSH_PASSWD&quot; | chpasswd
  
  RUN chmod u+x /code/init_container.sh
  
  # update the python packages and libraries
  
  RUN pip3 install --upgrade pip 
  RUN pip3 install --upgrade setuptools 
  RUN pip3 install --upgrade wheel
  RUN pip3 install -r requirements.txt
  
  # copy sshd_config file. See https://man.openbsd.org/sshd_config
  COPY sshd_config /etc/ssh/
  EXPOSE 8000 2222
  ENV PORT 8000
  ENV SSH_PORT 2222
  
  # install dependencies
  
  ENV ACCEPT_EULA=Y
  ENV APPENGINE_INSTANCE_CLASS=F2
  ENV apiUrl=https://api.beta.alt-f1.be
  ENV serverUrl=https://dunningcashflow-api.alt-f1.be
  
  ENV DOCKER_REGISTRY altf1be.azurecr.io
  
  ENTRYPOINT [&quot;/code/init_container.sh&quot;]
  </code></pre>
  <h1>/code/init_container.sh</h1>
  <pre class="lang-sh prettyprint-override"><code>gunicorn --config=app/conf/gunicorn.conf.docker.staging.py app.webapp:server
  </code></pre>
  <h1>app/conf/gunicorn.conf.docker.staging.py</h1>
  <pre class="lang-py prettyprint-override"><code># -*- coding: utf-8 -*-
  workers = 1
  # print(&quot;workers: {}&quot;.format(workers))
  bind = '0.0.0.0'
  timeout = 600
  log_level = &quot;debug&quot;
  reload = True
  print(
      f&quot;workers={workers} bind={bind} timeout={timeout} --log-level={log_level} --reload={reload}&quot;
  )
  </code></pre>
  <h1>container settings</h1>
  <p><a href="https://i.stack.imgur.com/7QMcQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7QMcQ.png" alt="Container settings - add command to run gunicorn" /></a></p>
  <h1>application settings</h1>
  <p><a href="https://i.stack.imgur.com/AvqQK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AvqQK.png" alt="Azure - application settings (update with WEBSITES_PORT)" /></a></p>
  <h1>web app running - 'the service is unavailable'</h1>
  <p><a href="https://i.stack.imgur.com/JUc7q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JUc7q.png" alt="Web App Error : the service unavailable" /></a></p>
  <h1>Kudu - 'the service is unavailable'</h1>
  <p><a href="https://i.stack.imgur.com/cIoJM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cIoJM.png" alt="Kudu - the service in unavailable" /></a></p>
  <h1>Kudu - http pings on port 8000 (the app was not running)</h1>
  <ul>
  <li><p>ERROR - Container altf1be-plotly-docker_0_ee297002 for site altf1be-plotly-docker has exited, failing site start</p>
  </li>
  <li><p>ERROR - Container altf1be-plotly-docker_0_ee297002 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.</p>
  </li>
  </ul>
  <h1></h1>