title: How to use nginx as a Local service on wercker
body: <p>tl;dr;</p>
  
  <p>I am trying to run nginx as a Local service to my dev pipeline with wercker, but I can't  find the right way to do it.</p>
  
  <p>Can anyone point me to a working example of a wercker multicontainer app which includes nginx as a Local service?</p>
  
  <hr>
  
  <p>My project is a Django app and the dev pipeline currently works OK, having only a database registered as service. I'm working to containerize the webserver and I would like to have it as a <em>Local Service</em>.</p>
  
  <p>Based on the "Local Services" section of this document: <a href="http://devcenter.wercker.com/docs/services/advanced-services.html" rel="nofollow">http://devcenter.wercker.com/docs/services/advanced-services.html</a>, I have tried the following:</p>
  
  <p>Project folder structure:</p>
  
  <pre><code>| (several other files) 
  |-- .web-container 
  |   |-- nginx-prd.conf 
  |   `-- wercker.yml 
  `-- wercker.yml       &lt;------------ this is my 'main' wercker file 
  </code></pre>
  
  <p>Inside the <em>main</em> wercker:</p>
  
  <pre><code>dev:
    services:
      - id: nginx
        url: file://.web-container/#dev
    steps:
      - script:
     (all the rest)
  </code></pre>
  
  <p>The .web-container/wercker.yml contains:</p>
  
  <pre><code>box: library/nginx
  dev:
    steps:
      - script:
          name: Copy config files
          code: |
              cp ./nginx-prd.conf /etc/nginx/nginx.conf
       - internal/watch:
          code: tail -f /var/log/nginx/error.log;
  </code></pre>
  
  <p>When I run <code>$ wercker --verbose dev</code> I get the message <strong>ERROR Session finished before sending commands: [mkdir -p "/pipeline/output"]</strong></p>
  
  <p>I found reports of issues with this same message when the container does not have a /bin/bash available, which is not the case. </p>
  
  <p>I have tried several small changes, like defining an entrypoint, define a different cmd but nothing has worked.</p>
  
  <hr>
  
  <p>wercker dev detailed output:</p>
  
  <pre><code>$ wercker --verbose dev
  --&gt; No Docker host specified, checking: /var/run/docker.sock
  --&gt; Executing pipeline
  --&gt; Copied working dir: 0.00s
  --&gt; Running step: setup environment
  Running wercker version: 1.0.560 (Compiled at: 2016-07-14T18:47:38Z, Git commit: 45904587eedbad1503e0cf69fc151a551a888d88)
  Using config:
  box: pitervergara/geodjango:nexchange
  
  dev:
    services:
      - id: nginx
        url: file://.web-container#dev
    steps:
      - script:
      ......... ommited ............
  Pulling from pitervergara/geodjango: nexchange
  Digest: sha256:df27f5f336a7a8b70f652205687c1f6cfb939d1061ac009d25cd36b100fe53d2
  Status: Image is up to date for pitervergara/geodjango:nexchange
  --&gt; Fetched docker.io/pitervergara/geodjango:nexchange: 4.97s
  --&gt; Executing pipeline
  --&gt; Copied working dir: 0.05s
  --&gt; Running step: setup environment
  Running wercker version: 1.0.560 (Compiled at: 2016-07-14T18:47:38Z, Git commit: 45904587eedbad1503e0cf69fc151a551a888d88)
  Using config:
  box: library/nginx
  dev:
      steps:
          - script:
              name: Copy config files
              code: |
                  cp ./nginx-prd.conf /etc/nginx/nginx.conf
  
          - internal/watch:
              code: tail -f /var/log/nginx/error.log;
  
  WARNING Ignoring dev step: internal/watch
  Pulling from library/nginx: latest
  Digest: sha256:0fe6413f3e30fcc5920bc8fa769280975b10b1c26721de956e1428b9e2f29d04
  Status: Image is up to date for nginx:latest
  --&gt; Fetched docker.io/library/nginx:latest: 3.97s
  --&gt; Source -&gt; Staging Area: 0.00s
  --&gt; Cache -&gt; Staging Area: 0.00s
  --&gt; Cache -&gt; Staging Area: 0.00s
  --&gt; Prepared step: wercker-init 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Copying source to container
  --&gt; Source+Cache -&gt; Guest: 0.06s
  export WERCKER="true"
  export WERCKER_ROOT="/pipeline/source"
  export WERCKER_SOURCE_DIR="/pipeline/source"
  export WERCKER_CACHE_DIR="/pipeline/cache"
  export WERCKER_OUTPUT_DIR="/pipeline/output"
  export WERCKER_PIPELINE_DIR="/pipeline"
  export WERCKER_REPORT_DIR="/pipeline/report"
  export WERCKER_APPLICATION_ID="web-container"
  export WERCKER_APPLICATION_NAME="web-container"
  export WERCKER_APPLICATION_OWNER_NAME="wercker"
  export WERCKER_APPLICATION_URL="https://app.wercker.com/#applications/web-container"
  export TERM="xterm-256color"
  export BUILD="true"
  export CI="true"
  export WERCKER_RUN_ID="d11db6b2-2849-4633-9860-012ec61d0fcb"
  export WERCKER_RUN_URL="https://app.wercker.com/#wercker/web-container/dev/d11db6b2-2849-4633-9860-012ec61d0fcb"
  export WERCKER_GIT_DOMAIN=""
  export WERCKER_GIT_OWNER=""
  export WERCKER_GIT_REPOSITORY=""
  export WERCKER_GIT_BRANCH="feature/nginx"
  export WERCKER_GIT_COMMIT="e60aea409e710d72fc8f66eef984ffc8f235a342"
  export WERCKER_BUILD_ID="d11db6b2-2849-4633-9860-012ec61d0fcb"
  export WERCKER_BUILD_URL="https://app.wercker.com/#wercker/web-container/dev/d11db6b2-2849-4633-9860-012ec61d0fcb"
  --&gt; Step passed: setup environment 4.82s
  --&gt; Running step: wercker-init
  export WERCKER_STEP_ROOT="/pipeline/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8"
  export WERCKER_STEP_ID="wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8"
  export WERCKER_STEP_OWNER="wercker"
  export WERCKER_STEP_NAME="wercker-init"
  export WERCKER_REPORT_NUMBERS_FILE="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/numbers.ini"
  export WERCKER_REPORT_MESSAGE_FILE="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/message.txt"
  export WERCKER_REPORT_ARTIFACTS_DIR="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/artifacts"
  source "/pipeline/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/init.sh"
  --&gt; Step passed: wercker-init 0.03s
  --&gt; Running step: Copy config files
  export WERCKER_STEP_ROOT="/pipeline/script-76c410b5-7832-4409-ac98-8cf6b93d9872"
  export WERCKER_STEP_ID="script-76c410b5-7832-4409-ac98-8cf6b93d9872"
  export WERCKER_STEP_OWNER="wercker"
  export WERCKER_STEP_NAME="script"
  export WERCKER_REPORT_NUMBERS_FILE="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/numbers.ini"
  export WERCKER_REPORT_MESSAGE_FILE="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/message.txt"
  export WERCKER_REPORT_ARTIFACTS_DIR="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/artifacts"
  source "/pipeline/script-76c410b5-7832-4409-ac98-8cf6b93d9872/run.sh" &lt; /dev/null
  --&gt; Step passed: Copy config files 0.05s
  --&gt; Steps passed: 7.37s
  --&gt; Exported Cache: 1.07s
  --&gt; Pipeline finished: 8.44s
  --&gt; Fetched run-d11db6b2-2849-4633-9860-012ec61d0fcb:feature_nginx: 15.10s
  --&gt; Source -&gt; Staging Area: 0.00s
  --&gt; Cache -&gt; Staging Area: 0.00s
  --&gt; Cache -&gt; Staging Area: 0.00s
  --&gt; Prepared step: wercker-init 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: npm-install 0.04s
  --&gt; Prepared step: npm-run 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: script 0.00s
  --&gt; Prepared step: watch 0.00s
  --&gt; Starting service nginx: /bin/bash
  --&gt; Copying source to container
  ERROR Session finished before sending commands: [mkdir -p "/pipeline/output"]
  ERROR --&gt; Step failed: setup environment 21.41s
  context canceled
  ERROR context canceled
  WARNING Service container has already stopped.
  WARNING Box container has already stopped.
  FATAL Exiting.
  </code></pre>