Run job on Docker image defined by Dockerfile in repository


I can tell the runner to run a job within a Docker image, using the jobs.<job_id>.container property. According to the documentation, “the value can be the Docker Hub image name or a public docker registry name.” I would like to run the job in an image defined by a Dockerfile within the repository, which should be built at the start of the workflow. Is this possible?


Unfortunately not, as far as I know. There are basically two approaches to do that:

  • Start from a public base image and run the preparation steps as part of your workflow. This has the advantage that you can use actions and all that inside the container.
  • Have the Dockerfile in your repository, use docker commands to build the container, and have an entry script that runs your build (or whatever steps you need). This has the advantage of using your Dockerfile as-is.