1 year ago

#219395

test-img

bkms2018

packer running on docker, amazon/google builders not working

My packer configuration is pretty basic.

source "amazon-ebs" "autogenerated_1" {                                                              
  ami_name      = "bharat-1"                                                                  
  instance_type = "t2.micro"                                                             
  region        = "us-west-2"                                                             
  source_ami    = "ami-b63ae0ce"                                                                     
  ssh_username  = "centos"                                                                         
}                                                                                                    

build {                                                                                              
  description = "AWS image"                                                                          
                                                                                                     
  sources   = ["source.amazon-ebs.autogenerated_1"]

This is working fine when run from my computer(CentOS 7.9 x86).

(venv) [bmukheja@devserver-bkumar-2 database_ami_project]$ packer build packer_config_4.pkr.hcl 
googlecompute.autogenerated_1: output will be in this color.

==> googlecompute.autogenerated_1: Checking image does not exist...
==> googlecompute.autogenerated_1: Creating temporary RSA SSH key for instance...
==> googlecompute.autogenerated_1: Using image: centos-7-v20220126
==> googlecompute.autogenerated_1: Creating instance...
    googlecompute.autogenerated_1: Loading zone: us-west2-a
    googlecompute.autogenerated_1: Loading machine type: n1-standard-1
    googlecompute.autogenerated_1: Requesting instance creation...
    googlecompute.autogenerated_1: Waiting for creation operation to complete...
    googlecompute.autogenerated_1: Instance has been created!
==> googlecompute.autogenerated_1: Waiting for the instance to become running...
    googlecompute.autogenerated_1: IP: 34.94.120.61
==> googlecompute.autogenerated_1: Using SSH communicator to connect: 34.94.120.61
==> googlecompute.autogenerated_1: Waiting for SSH to become available...

But my requirement is to run it inside a Centos 7.9 based docker container running on the same computer, packer doesn't run properly as below.

packer build packer_config_4.pkr.hcl
0 0

I'm unable to understand the issue here. Moreover, when I try to debug packer by passing PACKER_LOG=1 nothing appears on STDERR. Does anyone know where I'm going wrong?

docker

packer

amazon-ebs

hashicorp-packer

0 Answers

Your Answer

Accepted video resources