在 docker 上运行的打包机,亚马逊/谷歌构建器不工作

发布于 2025-01-09 13:13:31 字数 2466 浏览 4 评论 0原文

我的打包器配置非常基本。

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"]

从我的计算机(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...

但我的要求是在同一台计算机上运行的基于 Centos 7.9 的 docker 容器内运行它,packer 无法正常运行,如下所示。

packer build packer_config_4.pkr.hcl
0 0

我无法理解这里的问题。此外,当我尝试通过传递 PACKER_LOG=1 来调试加壳器时,STDERR 上没有显示任何内容。 有谁知道我哪里出错了?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文