Issue getting memcache container to automatically start in Docker
<p>I have a container that is being built that only really contains memcached, and I want it to start once the container is built.</p>

<p>This is my current Docker file - </p>

<pre><code>FROM centos:7
MAINTAINER Some guy &lt;someguy@guysome.org&gt;
RUN yum update -y
RUN yum install -y git https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

RUN yum install -y ansible &amp;&amp; yum clean all -y
RUN yum install -y memcached
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

VOLUME [ "/sys/fs/cgroup" ]
EXPOSE 11211/tcp 11211/udp
CMD ["/usr/bin/memcached"]
#CMD ["/usr/bin/memcached -u root"]
#CMD ["/usr/bin/memcached", "-D", "FOREGROUND"]
</code></pre>

<p>The container builds successfully, but when I try to run the container using the command </p>

<p><code>docker run -d -i -t -P &lt;image id&gt;</code>, I cannot see the image inside of the list that is returned with <code>docker ps</code>.</p>

<p>I attempted to have my memcached service run the same way as my httpd container, but I cannot pass in the argument using the -D flag (since its already a daemon im guessing).  This is how my httpd CMD was set up - </p>

<p><code>CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]</code></p>

<p>Locally, if I run the command <code>/usr/bin/memcached -u root</code> it runs as a process, but when I try in the container <code>CMD</code> it informs me that it cannot find the specified file (having to do with the -u root section I am guessing).</p>

<p>Setting the <code>CMD</code> to /bin/bash still did not allow the service to start either.</p>

<p>How can I have my memcached service run and allow it to be seen when I run <code>docker ps</code>, so that I can open a bash section inside of it?</p>

<p>Thanks.</p>