Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for #8120: "Unable to use packer with distroless base images" #86

Open
hc-github-team-packer opened this issue Nov 17, 2021 · 0 comments

Comments

@hc-github-team-packer
Copy link

This issue was originally opened by @mprzybylski in hashicorp/packer#11283 and has been migrated to this repository. The original issue description is below.


Hello,

I took @SwampDragons up on her suggestion in issue #8120 to "tinker and can figure out how to make (distroless images) work":

  • Start from one of the distroless "debug" images. These are identical to the base images except that they have busybox installed.
  • Change the run_command for the docker source to ["-d", "-i", "-t", "--entrypoint=/busybox/sh", "--", "{{.Image}}"]
  • Create a symlink from /busybox/sh to /bin/sh to make shell provisioners work:
    provisioner "shell-local"{
      inline = ["docker exec ${build.ID} ln -s /busybox/sh /bin/sh"]
    }
    
  • Optional: run a shell-local, docker-exec-hack provisioner to delete the /busybox directory after all other provisioning is complete:
    provisioner "shell-local" {
      only   = ["docker.ebpf_sensor"]
      inline = ["docker exec ${build.ID} rm -rf /bin/sh /busybox"]
    }
    

Hope this helps!

-Mike Przybylski

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant