Thanks for the pointer to the doc, will try out the troubleshooting method 
you suggested.

BTW, here is amateur-ish depiction of what is being attempted:

setup: 
EC2- Jenkins master ===== Standard + Docker Plugins ======> EC2 Docker Host

build flow:
Build job request --> EC2 Jenkins master --> EC2 Docker Host --> Start new 
container --> run packer command to build AMI

Essentially, inside the container, packer command is executed to create AMI 
using packer template which is set to of run whole bunch of ansible 
playbooks (split in to various roles) using amazon-builder.

And, all of this is drama happens in AWS cloud environment.

HTH,

/Ram

On Friday, March 16, 2018 at 2:01:51 PM UTC+5:30, Rickard von Essen wrote:
>
> First of all Packer doesn't work with remote Docker hosts. (I updated the 
> docs to be more clear on this just some days ago, pending deploy, see 
> https://github.com/hashicorp/packer/pull/5992) 
>
> If you instead run a Jenkins agent on the host you would like to run the 
> packer build on everything should work out-of-the-box. If not the best way 
> to troubleshot it is to add a sleep into the container and jump in to it 
> and verify that you get appropriate AWS access keys and roles from the 
> metadata api:
>
> curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
> <role-name>
>
> On 14 March 2018 at 10:10, Alvaro Miranda Aguilera <[email protected] 
> <javascript:>> wrote:
>
>> Hello
>>
>> If I understand correctly, you want to run packer inside the EC2 that 
>> have jenkins to build docker inside the EC2 with docker, right?
>>
>> Can you setup DOCKER_HOST variable before running packer and testing you 
>> can list/build using docker commands ?
>>
>> If this is setup, share your template.json output of docker version on 
>> the remote EC2 machine and packer build debug logs
>>
>> Thanks
>> Alvaro
>>
>> On Wed, Mar 14, 2018 at 4:35 AM, Ramanathan Muthaiah <[email protected] 
>> <javascript:>> wrote:
>>
>>> Hello,
>>>
>>> In a AWS cloud environment (personal account), I have a EC2 instance 
>>> acting as Docker Host and another EC2 instance that runs Jenkins. From 
>>> Jenkins master, I have successfully configured to fire up container slaves 
>>> in the Docker Host -- intent is to have these containers as build agents.
>>>
>>> FYI, EC2 instance acting as the Docker Host is assigned an IAM role that 
>>> has complete access to create ec2 instances, key parirs, et al.
>>>
>>> With this setup, am attempting to run a packer build, from one of the 
>>> containers, to create a AMI. However, packer builds fails complaining about 
>>> the lack of permissions to launch source instance.
>>>
>>> FWIW, am using amazon-ebs builder in Packer template. Will it help if 
>>> the builder is changed to chroot ?
>>>
>>> The build jobs are run as non-root user.
>>>
>>> Any help would be appreciated ?
>>>
>>> /Ram
>>>
>>> -- 
>>> This mailing list is governed under the HashiCorp Community Guidelines - 
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>>> violation of those guidelines may result in your removal from this mailing 
>>> list.
>>>  
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/packer-tool/129d3f07-6913-4ce4-a76f-74153bd65e54%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/packer-tool/129d3f07-6913-4ce4-a76f-74153bd65e54%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Alvaro
>>
>> -- 
>> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/CAHqq0ex20rTu%2BCOwJum_0qVWA1AUMbFTuWj5y1Dj06pfkK2DHA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/CAHqq0ex20rTu%2BCOwJum_0qVWA1AUMbFTuWj5y1Dj06pfkK2DHA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/cc802cf9-ab50-4239-a5f5-49caaedc01a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to