Skip to content

Proposal: Publish data image in ghcr #387

Description

@b-dean

🗣️ Foreword

I'd like to split the Dokken::Helpers#create_data_image and related methods out to be a proper Dockerfile that is built by github actions and published to ghcr.io registry.

🙍 Problem Statement

The reason I want to do this is I am running dokken inside a Docker-in-Docker environment, where it will end up building the data image. But it tries to build this every test and sometimes runs into errors with the Docker API such as the cryptic.

E, [2026-07-20T22:31:54.999565 #43] ERROR -- Kitchen: Message: Failed to complete #create action: [{"message":"dockerfile parse error on line 1: unknown instruction: \u0000\u0000\u0000 ... repeat this over 700 times ... \u0000\u0000"}

or

Kitchen: Message: Failed to complete #create action: [You tried to feed more data than fits in the file.] on some-test
Kitchen: ----------------------
Kitchen: ------Backtrace-------
Kitchen: /usr/local/lib/ruby/site_ruby/3.4.0/rubygems/package/tar_writer.rb:45:in 'Gem::Package::TarWriter::BoundedStream#write'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:187:in 'IO.copy_stream'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:187:in 'block (3 levels) in Docker::Util.create_relative_dir_tar'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:207:in 'Docker::Util.add_file_to_tar'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:184:in 'block (2 levels) in Docker::Util.create_relative_dir_tar'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:179:in 'Array#each'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:179:in 'block in Docker::Util.create_relative_dir_tar'
Kitchen: /usr/local/lib/ruby/site_ruby/3.4.0/rubygems/package/tar_writer.rb:81:in 'Gem::Package::TarWriter.new'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:176:in 'Docker::Util.create_relative_dir_tar'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/util.rb:144:in 'Docker::Util.create_dir_tar'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/docker-api-2.4.0/lib/docker/image.rb:312:in 'Docker::Image.build_from_dir'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/kitchen-dokken-2.23.1/lib/kitchen/helpers.rb:99:in 'Dokken::Helpers#create_data_image'
Kitchen: /home/ec2-user/workspace/some-cookbook@2/src/.vendor/bundle/ruby/3.4.0/gems/kitchen-dokken-2.23.1/lib/kitchen/driver/dokken.rb:420:in 'Kitchen::Driver::Dokken#make_data_image'
....

(I know using bundler and whatnot to run kitchen, just ignore that.)

Both of these could be avoided by just not building the data image every time.

❔ Possible Solution

The only part of the data image that's really dynamic is this line:
https://github.com/test-kitchen/kitchen-dokken/blob/main/lib/kitchen/helpers.rb#L86

which creates a volume pointing to instance.provisioner[:root_path] || "/opt/kitchen"

This could could be done at data container launch time (in start_data_container) with:

config = {
  # ...
  "Volumes" => {
    resolved_root_path => { }
  },
}

People can still use their own data image if they like, but we could default it to something like ghcr.io/test-kitchen/dokken-data:latest

⤴️ Describe alternatives you've considered

I made a repo b-dean/kitchen-docken-data-image to publish a build of the current data image. I can run it by having:

driver:
  name: dokken
  data_image: ghcr.io/b-dean/kitchen-dokken-data-image
lifecycle:
  pre_create:
    - docker pull ghcr.io/b-dean/kitchen-dokken-data-image

But really this should probably just be in kitchen-dokken itself.

➕ Additional context

I could make a PR for this, but wanted to get some feedback before I started working on it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions