Dockerized packer
with useful tools.
Tag | Dockerfile Build Context |
---|---|
:1.11.2-sops-ubuntu-22.04 , :latest |
View |
:1.11.2-sops-qemu-ubuntu-22.04 |
View |
:1.11.2-sops-virtualbox-7.0.20-ubuntu-22.04 |
View |
:1.11.2-sops-virtualbox-7.1.2-ubuntu-22.04 |
View |
:1.7.7-sops-ubuntu-20.04 |
View |
:1.7.7-sops-qemu-ubuntu-20.04 |
View |
:1.7.7-sops-virtualbox-7.0.20-ubuntu-20.04 |
View |
:1.7.7-sops-virtualbox-7.0.8-ubuntu-20.04 |
View |
:1.7.7-sops-virtualbox-6.1.44-ubuntu-20.04 |
View |
:1.7.7-sops-virtualbox-6.1.40-ubuntu-20.04 |
View |
:1.7.7-sops-virtualbox-6.1.26-ubuntu-20.04 |
View |
:1.7.7-sops-qemu-ubuntu-18.04 |
View |
:1.7.7-sops-virtualbox-6.0.24-ubuntu-18.04 |
View |
:1.7.7-sops-virtualbox-5.2.44-ubuntu-16.04 |
View |
Packer configuration can be done via .packerconfig
config file or environment variables (e.g. PACKER_LOG=1
for verbose logging). Environment variables are preferred when using docker.
# Note: The GID of the group 'kvm' in the container must match the host's. If not, use --privileged instead of --device. See: https://stackoverflow.com/questions/48422001/how-to-launch-qemu-kvm-from-inside-a-docker-container
docker run --rm -it \
--device /dev/kvm \
-v $(pwd):/src \
-w /src \
theohbrothers/docker-packer:1.11.2-sops-qemu-ubuntu-22.04 packer build template.json
See examples:
The host may need to have an exact matching virtualbox version, or at least the same virtualbox minor version, if not virtualbox may not be able to start VMs. To verify virtualbox can start VMs, run the following, ensuring there is no error message:
docker run --rm -it \
--device /dev/vboxdrv \
theohbrothers/docker-packer:1.11.2-sops-virtualbox-7.0.20-ubuntu-22.04 vboxmanage --version
If all is well, to build a VM image:
docker run --rm -it \
--device /dev/vboxdrv \
-v $(pwd):/src \
-w /src \
theohbrothers/docker-packer:1.11.2-sops-virtualbox-7.0.20-ubuntu-22.04 packer build template.json
See examples:
docker run --rm -it \
-v $(pwd):/src \
-w /src \
theohbrothers/docker-packer:1.11.2-sops-ubuntu-22.04 packer build template.json
Requires Windows powershell
or pwsh
.
# Install Generate-DockerImageVariants module: https://github.com/theohbrothers/Generate-DockerImageVariants
Install-Module -Name Generate-DockerImageVariants -Repository PSGallery -Scope CurrentUser -Force -Verbose
# Edit ./generate templates
# Generate the variants
Generate-DockerImageVariants .