<p><a href="https://github.com/GoingOffRoading/GlusterFS/blob/main/GlusterFS-Server/dockerfile" rel="nofollow noreferrer">Current dockerfile</a>:</p>
<pre><code>FROM ubuntu:latest

RUN apt-get update &amp;&amp; \
    apt-get install -y software-properties-common &amp;&amp; \
    add-apt-repository ppa:gluster/glusterfs-9 &amp;&amp; \
    apt-get update &amp;&amp; \
    apt-get install -y glusterfs-server

CMD [&quot;/usr/sbin/init&quot;]
</code></pre>
<p>Using this, the container starts perfectly...  However the service being installed (Gluster) doesn't start.</p>
<p>I've tried combinations of RUN, CMD, &amp; ENTRYPOINT scripts executing variations of &quot;service glusterd start&quot; (the command  to start the Gluster daemon) but those combinations:</p>
<ul>
<li>Cause the container to exit on creation</li>
<li>Cause errors that crash the container</li>
</ul>
<p>I can confirm &quot;service glusterd start&quot; is the correct command that needs to be run, as:</p>
<ul>
<li>I can SSH into the running container/pod</li>
<li>Confirm that the Gluster daemon is not running</li>
<li>Run &quot;service glusterd start&quot; in the container/pod without errors</li>
<li>Confirm  that the Gluster daemon has started after running &quot;service glusterd start&quot;</li>
</ul>
<p>Any ideas on how to execute &quot;service glusterd start&quot; at the container creation in the dockerfile?</p>

Chase Westlye
<p>Real credit goes to DaveMaze in the comments... His note about service/systemctl and CMD lead me down a path that ended up working:</p>
<pre><code>FROM ubuntu:latest

RUN apt-get update &amp;&amp; \
    apt-get install -y software-properties-common &amp;&amp; \
    add-apt-repository ppa:gluster/glusterfs-9 &amp;&amp; \
    apt-get update &amp;&amp; \
    apt-get install -y glusterfs-server

CMD glusterd -N
</code></pre>
<p>Works perfectly.</p>
