Run py.test in a docker container as a service
<p>I am working on setting up a dockerised selenium grid. I can send my python tests [run with pytest] from a pytest container [see below] by attaching to it.
But I have setup another LAMP container that is going to control pytest.
So I want to make the pytest container standalone,running idle and waiting for commands from the LAMP container.</p>

<p>I have this Dockerfile:</p>

<pre><code># Starting from base image
FROM ubuntu

#-----------------------------------------------------
# Set the Github personal token
ENV GH_TOKEN blablabla

# Install Python &amp; pip
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python python-pip python-dev &amp;&amp; pip install --upgrade pip

# Install nano for #debugging
RUN apt-get install -y nano

# Install xvfb
RUN apt-get install -y xvfb

# Install GIT
RUN apt-get update -y &amp;&amp; apt-get install git -y

# [in the / folder] 
RUN git clone https://$GH_TOKEN:x-oauth-basic@github.com/user/project.git /project

# Install dependencies via pip
WORKDIR /project
RUN pip install -r dependencies.txt
#-----------------------------------------------------

#
CMD ["/bin/bash"]
</code></pre>

<p>I start the pytest container manually [for development] with this:</p>

<pre><code>docker run -dit -v /project --name pytest repo/user:py
</code></pre>

<p>The thing is that I finished development and I want to have the pytest container launched from <code>docker-compose</code> and connect it to other containers [with link and volume].
I just cannot make it to stay up .</p>

<p>I used this :</p>

<pre><code>pytest:
  image: repo/user:py
  volumes:
    - "/project"
  command: "/bin/bash tail -f /dev/null"
</code></pre>

<p>but didnt work.</p>

<p>So, inside the Dockerfile, should I use a specific CMD or ENTRYPOINT ?</p>

<p>Should I use some <code>command</code> from the <code>docker-compose</code> file?</p>