The above example uses the object exposed by  withRun , which has the running container’s ID available via the  id  property. Using the container’s ID, the Pipeline can create a link by passing custom Docker arguments to the  inside()  method. The  id  property can also be useful for inspecting logs from a running Docker container before the Pipeline exits: sh "docker logs ${c.id}" In order to create a Docker image, the plugin:docker-workflow[Docker Pipeline] plugin also provides a  build()  method for creating a new image, from a  Dockerfile  in the repository, during a Pipeline run. One major benefit of using the syntax  docker.build("my-image-name")  is that a Scripted Pipeline can use the return value for subsequent Docker Pipeline calls, for example: The return value can also be used to publish the Docker image to Docker Hub, or a custom Registry, via the  push()  method, for example: One common usage of image "tags" is to specify a  latest  tag for the most recently, validated, version of a Docker image. The  push()  method accepts an optional  tag  parameter, allowing the Pipeline to push the  customImage  with different tags, for example: 56 node { checkout scm def customImage = docker.build("my-image:${env.BUILD_ID}") customImage.push() } node { checkout scm def customImage = docker.build("my-image:${env.BUILD_ID}") customImage.inside { sh 'make test' } } Building containers