title: Simple example to build a Dockerfile in Azure
body: <p>Does anyone have a working azure-pipelines.yaml file that utilizes containers only to build Dockerfiles which I have in my repo.</p>
  
  <pre><code>resources:
      containers:
          - container: docker-image
            image: docker:18.09.6
  
  jobs:
      - job: Build
        container: docker-image
        steps:
            - script: |
                  echo hello from Linux
                  Docker --version
  </code></pre>
  
  <p>The above ends up with the error:</p>
  
  <pre><code>##[section]Starting: Initialize containers
  ##[command]/usr/bin/docker version --format '{{.Server.APIVersion}}'
  '1.40'
  Docker daemon API version: '1.40'
  ##[command]/usr/bin/docker version --format '{{.Client.APIVersion}}'
  '1.40'
  Docker client API version: '1.40'
  ##[command]/usr/bin/docker ps --all --quiet --no-trunc --filter "label=f38b39"
  ##[command]/usr/bin/docker network prune --force --filter "label=f38b39"
  ##[command]/usr/bin/docker network create --label f38b39 vsts_network_b78f6272ef304388ac849f3f37071eea
  fda578a22eeb5aae1fcd41a4b816a279d20cfa552dbe3ad366fa2a009ab35313
  ##[command]/usr/bin/docker pull docker:18.09.6
  18.09.6: Pulling from library/docker
  e7c96db7181b: Already exists
  5297bd381816: Pulling fs layer
  3a664477889c: Pulling fs layer
  a9b893dcc701: Pulling fs layer
  48bf7c1cb0dd: Pulling fs layer
  555b6ea27ad2: Pulling fs layer
  48bf7c1cb0dd: Waiting
  555b6ea27ad2: Waiting
  3a664477889c: Verifying Checksum
  3a664477889c: Download complete
  5297bd381816: Download complete
  48bf7c1cb0dd: Verifying Checksum
  48bf7c1cb0dd: Download complete
  5297bd381816: Pull complete
  555b6ea27ad2: Verifying Checksum
  555b6ea27ad2: Download complete
  a9b893dcc701: Verifying Checksum
  a9b893dcc701: Download complete
  3a664477889c: Pull complete
  a9b893dcc701: Pull complete
  48bf7c1cb0dd: Pull complete
  555b6ea27ad2: Pull complete
  Digest: sha256:bf929409251faa1d1fcf63af68d02bb942054cfbe14e6ad9dca0dc4a01cbffad
  Status: Downloaded newer image for docker:18.09.6
  docker.io/library/docker:18.09.6
  ##[command]/usr/bin/docker inspect --format="{{index .Config.Labels \"com.azure.dev.pipelines.agent.handler.node.path\"}}" docker:18.09.6
  ##[command]/usr/bin/docker create --name docker-image_docker18096_794554 --label f38b39 --network vsts_network_b78f6272ef304388ac849f3f37071eea  -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/vsts/work/1":"/__w/1" -v "/home/vsts/work/_temp":"/__w/_temp" -v "/opt/hostedtoolcache":"/__t" -v "/home/vsts/work/_tasks":"/__w/_tasks" -v "/home/vsts/agents/2.150.3/externals":"/__a/externals":ro -v "/home/vsts/work/.taskkey":"/__w/.taskkey" docker:18.09.6 "/__a/externals/node/bin/node" -e "setInterval(function(){}, 24 * 60 * 60 * 1000);"
  b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0
  ##[command]/usr/bin/docker start b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0
  b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0
  ##[command]/usr/bin/docker ps --all --filter id=b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0 --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
  b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0 Up Less than a second
  ##[command]/usr/bin/docker exec  b8856a42131206302453903ae8fbc85957368b2e377ee5a9d1b44627130006b0 sh -c "command -v bash"
  OCI runtime exec failed: exec failed: cannot exec a container that has stopped: unknown
  ##[error]Docker exec fail with exit code 126
  ##[section]Finishing: Initialize containers
  </code></pre>