Skip to content

Build Docker images

Container images built as part of pipeline can be pushed to any public or private Docker registry. For more details, see "Using Docker registries".

Supported steps

Razorops provides two declarative steps to build and push container images - docker/build and docker/push.

docker/build is just a declarative way of running docker build command as a part of pipeline. It supports following properties:

  - docker/build:
      image: example.com/hello
      tags: [v1]
      dockerfile: Dockerfile.build
    ...
  • image - The name of container image to build (without the tag part)
  • tags - The list of tags for the container image. By default latest will be used. You can interpolate the value using "Substitutions".
  • dockerfile - Path of dockerfile relative to root of your source repo
  • args - an array of Docker build arguments (--build-arg) in key=value format. The value can be interpolated the value using "Substitutions".
  • context - Docker context (. by default)
  • target - target stage for a multistage build (build will run until this stage).
  • push - push the image to a Docker registry (default: false).

If you want to push a container image to a remote Docker registry, tag the image and use docker/push step. It supports following properties:

  - docker/push:
      image: example.com/hello
      tags: [v1]
  • image - The name of container image to build (without the tag part)
  • tags - The list of tags for the container image. By default latest will be used. You can interpolate the value using "Substitutions".

docker/push is just a declarative way of running docker push command as a part of pipeline.

Limitations

For Docker based environment, the daemon runs in dind mode, which has a set of issues compared to VM based environment. For security reasons, few command are restricted like docker run --privileged, docker run --mount, and mapping volumes with a source outside of current workspace.

Troubleshooting

  • docker: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running? - This is a common error when you are using Docker in Docker v19.03 or higher. This occurs because Docker starts on TLS automatically.