title: How do I pass a docker image from one TeamCity build to another?
body: <p>I need to split a teamcity build that builds and pushes a docker image into a docker registry into two separate builds.</p>
  
  <p>a) The one that builds the docker image and publishes it as an artifact</p>
  
  <p>b) The one that accepts the docker artifact from the first build and pushes it into a registry</p>
  
  <p>The log says, that there are these three commands running:</p>
  
  <pre><code>docker build -t thingy -f /opt/teamcity-agent/work/55abcd6/docker/thingy/Dockerfile /opt/teamcity-agent/work/55abcd6
  docker tag thingy docker.thingy.net/thingy/thingy:latest
  docker push docker.thingy.net/thingy/thingy:latest
  </code></pre>
  
  <p>There's plenty of other stuff going on, but I figured that this is the important part.</p>
  
  <p>So I have copied the initial build two times, with the first command in the first build, and the next two in the second build.</p>
  
  <p>I have set the first build as a snapshot dependency for the second build, and run it. And what I get is:</p>
  
  <pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'docker': 'docker'
  </code></pre>
  
  <p>Which probably is because some of the files are missing.</p>
  
  <p>Now, I did want to publish the docker image as an artifact, and make the first build an artifact dependency, but I can't find where does the docker put its files and all of the searches containing a "docker" and a "file" in them just lead to a bunch of articles about what the Dockerfile is.</p>
  
  <p>So what can I do to make it so that the second build could use the resulting image and/or enviroment from the first build?</p>