title: Docker container run cypress tests in Jenkins
body: <p>I have an application which i am wrapping into docker container, so am able to run tests locally by</p>
  <pre><code>docker compose --build app-e2e
  </code></pre>
  <p>which builds up app first and runs cypress tests, however running on jenkins shows error that &quot;Cypress could not verify that this server is running: <a href="http://127.0.0.1:8844%22" rel="nofollow noreferrer">http://127.0.0.1:8844&quot;</a></p>
  <p>cypress.json</p>
  <pre><code>{
    &quot;viewportWidth&quot;: 1920,
    &quot;viewportHeight&quot;: 1024,
    &quot;integrationFolder&quot;: &quot;cypress/integration&quot;,
    &quot;supportFile&quot;: &quot;cypress/support/index.ts&quot;,
    &quot;videosFolder&quot;: &quot;cypress/videos&quot;,
    &quot;screenshotsFolder&quot;: &quot;cypress/screenshots&quot;,
    &quot;pluginsFile&quot;: &quot;cypress/plugins/index.ts&quot;,
    &quot;fixturesFolder&quot;: &quot;cypress/fixtures&quot;,
    &quot;baseUrl&quot;: &quot;http://127.0.0.1:8844&quot;,
    &quot;video&quot;: false
  }
  </code></pre>
  <p>.env (env variables I setted service port to 8844 same as in cypress.json)</p>
  <pre><code>NPM_USERNAME=
  NPM_PASSWORD=
  NPM_EMAIL=
  BACKEND_URI=https://content-builder-api-dmb.xenialdev.net
  SERVICE_PORT=8844
  
  </code></pre>
  <p>Dockerfile.e2e</p>
  <pre><code>FROM cypress/base:12.1.0
  
  ARG NPM_USERNAME
  ARG NPM_PASSWORD
  ARG NPM_EMAIL
  
  # create work directory
  RUN mkdir /app
  WORKDIR /app
  
  # Copy project files
  COPY . /app
  
  # Npm login
  COPY .npmrc /app/.npmrc
  COPY ./scripts/npm-login /app/npm-login
  RUN cd npm-login &amp;&amp; \
      npm install --loglevel=warn &amp;&amp; \
      node run.js &quot;$NPM_USERNAME&quot; &quot;$NPM_PASSWORD&quot; &quot;$NPM_EMAIL&quot;
  
  # Copy project dependencies files
  COPY package.json /app/package.json
  COPY package-lock.json /app/package-lock.json
  
  # Install dependencies
  RUN npm install
  
  # Verify cypress installed and started
  RUN $(npm bin)/cypress verify
  
  </code></pre>
  <p>docker-compose.yml</p>
  <pre><code>  xdmb-e2e:
      build:
        context: .
        dockerfile: Dockerfile.e2e
        args:
          NPM_USERNAME: ${NPM_USERNAME}
          NPM_PASSWORD: ${NPM_PASSWORD}
          NPM_EMAIL: ${NPM_EMAIL}
      depends_on:
        xdmb-ui:
          condition: service_started
      network_mode: 'host'
      command: 'npm run cypress:run'
  </code></pre>
  <p>I set <code>network_mode: 'host'</code> to be able to run app in <code>http://127.0.0.1:8844</code></p>