How To Build and Publish a Container Image

In this blog post we are going to show how to build and publish container images using the oci-build task and registry-image resource. This post assumes you understand how to build container images with Dockerfile's and publish to Docker Hub or another image registry using the docker cli.

This is a companion discussion topic for the original entry at

Thank you for this blog. This indeed seems to be the right way to build and publish images. When I recently started using docker-image for this purpose, it didn’t seem right that the docker image was getting built in a [put] step, until I came across this blog. It would be nice to add a reference to this blog in the README file for docker-image resource.

I do have few comments/questions about the registry-image and the oci-build-task approach. The docker-image seems to support many features that could be missing here or seem to be not documented. For example, does it support the following attributes:

  • tag_file
  • tag_as_latest
  • tag_prefix
  • load
  • load_base
  • load_file
  • load_tag

For what I want, I am building an image with oci-build-task, pushing it to private docker registry using registry-image and then have a 2nd oci-build-task which loads the image built in the first step and build another docker image and push it to our private docker registry. However, I am not sure how to implement the 2nd part as it is not able to load the docker image built in the first step.