<p>I have a Dockerfile running Kong-api to deploy on openshift. It build okay, but when I check pods I get <code>Back-off restarting failed container</code>. Here is my dockerfile</p>

<pre><code>FROM ubuntu:18.04
RUN apt-get update &amp;&amp; apt-get install -y apt-transport-https curl lsb-core
RUN echo "deb https://kong.bintray.com/kong-deb `lsb_release -sc` main" | tee -a /etc/apt/sources.list
RUN curl -o bintray.key https://bintray.com/user/downloadSubjectPublicKey?username=bintray
RUN apt-key add bintray.key
RUN apt-get update &amp;&amp; apt-get install -y kong

COPY kong.conf /etc/kong/
RUN kong migrations bootstrap [-c /etc/kong/kong.conf]

EXPOSE 8000 8443 8001 8444
ENTRYPOINT ["kong", "start", "[-c /etc/kong/kong.conf]"]
</code></pre>

<p>Where is my wrong? Please help me. Thanks in advance</p>

Akashii
<p>In order to make the kong start correctly, you need to execute these commands when you have an active Postgres connection:</p>

<pre><code>kong migrations bootstrap &amp;&amp; kong migrations up
</code></pre>

<p>Also, note that the format of the current Dockerfile is not valid if you would like
to pass options within the <code>ENTRYPOINT</code> you can write it like that:</p>

<pre><code>ENTRYPOINT ["kong", "start","-c", "/etc/kong/kong.conf"]
</code></pre>

<p>Also, you need to remove this line:</p>

<pre><code>RUN kong migrations bootstrap [-c /etc/kong/kong.conf]

</code></pre>

<p>Note that the format of the above line is not valid as <code>RUN</code> expects a normal shell command so using <code>[]</code> in this case is not correct.</p>

<p>So as you deploy to Openshift there are several ways to achieve what you need.</p>

<ul>
<li>You can make use of <a href="https://docs.openshift.com/container-platform/4.1/nodes/containers/nodes-containers-init.html" rel="nofollow noreferrer">initContainers</a> which allows you to execute the required commands before the actual service is up.</li>
<li>You can check <a href="https://github.com/helm/charts/tree/master/stable/kong" rel="nofollow noreferrer">the official helm chart for Kong</a> in order to know how it works or use helm to install Kong itself.</li>
</ul>
