<p>I have basically a docker image of a node js application. </p>

<p>REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
abc-test            0.1              1ba85e0ca455        7 hours ago         1.37GB</p>

<p>I want to run npm test from folder /data/node/src but that doesn't seems to be working.</p>

<p>Here is the command what I am trying:</p>

<p>docker run -p 80:80 --entrypoint="cd /data/node/src &amp;&amp; npm run test" abc-test:0.1</p>

<p>But that doesn't seems to be working.</p>

<p>Here is my dockerfile:</p>

<pre><code>FROM python:2.7.13-slim
RUN apt-get update &amp;&amp; apt-get install -y apt-utils curl
RUN echo 'deb http://nginx.org/packages/debian/ jessie nginx' &gt; /etc/apt/sources.list.d/nginx.list

RUN apt-get update &amp;&amp; apt-get install -y \
    build-essential \
    gcc \
    git \
    libcurl4-openssl-dev \
    libldap-2.4-2 \
    libldap2-dev \
    libmysqlclient-dev \
    libpq-dev \
    libsasl2-dev \
    nano \
    nginx=1.8.* \
    nodejs \
    python-dev \
    supervisor

ENV SERVER_DIR /data/applicationui/current/server

ADD src/application/server $SERVER_DIR

EXPOSE 14000 80
# version A: only start tornado, without nginx.
 WORKDIR $SERVER_DIR/src
 CMD ["npm","run","start:staging"]
</code></pre>

<p>Can anyone please help me here.</p>

kaounKaoun
<p>Pretty sure you can only run one command with ENTRYPOINT and with CMD. </p>

<p>From their docs: </p>

<blockquote>
  <p>There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.</p>
</blockquote>

<p>Same thing with Entrypoint:</p>

<blockquote>
  <p>ENTRYPOINT has two forms:</p>
  
  <ol>
  <li>ENTRYPOINT ["executable", "param1", "param2"] (exec form, preferred)</li>
  <li>ENTRYPOINT command param1 param2 (shell form)</li>
  </ol>
</blockquote>

<p><a href="https://docs.docker.com/engine/reference/builder/#cmd" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/builder/#cmd</a>
<a href="https://docs.docker.com/engine/reference/builder/#entrypoint" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/builder/#entrypoint</a></p>

<p>A work around that I do is the following</p>

<pre><code>FROM ubuntu:16.04
WORKDIR /home/coins
RUN apt-get update

...
OTHER DOCKERFILE STUFF HERE
...


COPY ./entrypoint.sh /home/coins/
RUN chmod +x ./entrypoint.sh
ENTRYPOINT ./entrypoint.sh
</code></pre>

<p>entrypoint.sh:</p>

<pre><code>#!/bin/bash
Can write whatever sh commands you need here..
exec sh ./some_script
</code></pre>

<p>EDIT:</p>

<p>One idea is you can add a test sh script and just trigger those 2 commands in it, and you'd be able to launch it with --entrypoint="test.sh"</p>
