我有一个在 AWS 上构建的 CentOS Packer,它适用于 1.1.2 版,但在 1.1.3 版上失败
用于构建镜像的模板(来源 AMI ID 取自 https://wiki.centos.org/Cloud/AWS)
{
"builders": [
{
"access_key": "{{user `aws_access_key`}}",
"ami_block_device_mappings": [
{
"device_name": "/dev/sdb",
"virtual_name": "ephemeral0"
},
{
"device_name": "/dev/sdc",
"virtual_name": "ephemeral1"
}
],
"ami_description": "CentOS 7 with updates ({{isotime \"2006-01-02-15-04-05\"}})",
"ami_name": "centos7-with-updates-{{isotime \"2006-01-02-15-04-05\"}}",
"ami_regions": [
"us-west-2"
],
"ami_users": [
"XXXXXXXXXXXX"
],
"instance_type": "t2.medium",
"region": "us-east-1",
"secret_key": "{{user `aws_secret_key`}}",
"source_ami": "ami-ae7bfdb8",
"ssh_username": "centos",
"type": "amazon-ebs"
}
],
"post-processors": [
{
"inline": [
"date",
"exit 0"
],
"type": "shell-local"
}
],
"provisioners": [
{
"inline": [
"sleep 10",
"sudo yum -y update",
"sudo yum -y install unzip vim tree",
"sudo yum remove -y docker docker-common docker-selinux docker-engine",
"sudo yum install -y yum-utils device-mapper-persistent-data lvm2",
"sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo",
"sudo yum install -y docker-ce",
"sudo systemctl enable docker",
"sudo yum clean all",
"sudo rm -rf /var/cache/yum/",
"exit 0"
],
"type": "shell"
}
],
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
}
}
_如你所见,我没有做任何复杂的事情,只是一个支持 Docker 的 CentOS 7 镜像。_
当使用版本 1.1.3 构建失败时,它会超时并显示以下错误:
==> amazon-ebs: Waiting for instance (i-xxxxxxxxxxxxxxxxx) to become ready...
==> amazon-ebs: Error waiting for instance (i-xxxxxxxxxxxxxxxxx) to become ready: ResourceNotReady: exceeded wait attempts
packer version
Packer 版本如果我使用 v 1.1.2运行 about 模板,它工作正常。 (我用 1.10 和 1.1.1 进行了测试,这些也有效)
问候,
尚塔努
添加ec2:DescribeInstanceStatus
现在已经使这个工作了,虽然启动时间有点慢。
细节可能很好地涵盖在:
https://github.com/hashicorp/packer/issues/5705
https://github.com/hashicorp/packer/pull/5773
等待 v1.1.4 看看启动是否和 v1.1.2 一样。
感谢致敬,
尚塔努
谢谢你的票。 看起来你找到了解决方案。 1.1.4 将比 1.1.3 快得多。
我将锁定此问题,因为它已关闭 _30 天_⏳。 这有助于我们的维护人员找到并关注活跃的问题。
如果您发现与此类似的问题,请打开一个新问题并完成问题模板,以便我们可以获取进一步调查所需的所有详细信息。
最有用的评论
谢谢你的票。 看起来你找到了解决方案。 1.1.4 将比 1.1.3 快得多。