That worked great, thank you! Two things I learned:
1) sudo is a package that can be installed like any other (somehow I thought it was built-in to all Linuxes) 2) provisioners support the "only" attribute (somehow I missed that when reading the docs) I like this because I'm now also able to run the "sleep 30" only on "amazon-ebs". It is not necessary on "docker" and was unnecessarily delaying the build. Thanks again On Wednesday, March 29, 2017 at 12:00:52 PM UTC-5, Rickard von Essen wrote: > > Just install sudo in the docker image in a shell provisioner with "only": > [ "docker" ]. > > On Mar 29, 2017 6:22 PM, "Kevin Pauli" <[email protected] <javascript:>> > wrote: > >> Newbie here, trying to figure out how to build both a docker image and an >> amazon-ebs ami from the same script. Here I have stripped it down to the >> essentials: >> >> { >> "builders": [ >> { >> "type": "amazon-ebs", >> "ami_name": "my-ami", >> "instance_type": "t2.micro", >> "region": "us-east-1", >> "source_ami": "ami-f4cc1de2", >> "ssh_username": "ubuntu" >> }, >> { >> "type": "docker", >> "image": "ubuntu:16.04" >> } >> ], >> "provisioners": [ >> { >> "type": "shell", >> "inline": [ >> "sleep 30", >> "sudo apt-get update" >> ] >> } >> ] >> } >> >> The problem is the "apt-get update" command... >> >> If I do not include sudo, the docker build works but the amazon-ebs ami >> fails to provision with "Permission denied" errors. >> >> If I do include the sudo, the amazon-ebs build works but the docker build >> fails with "sudo: not found ". How to solve this? >> >> -- >> 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/a17dff65-ef29-4c88-853d-d32fcc9df357%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/a17dff65-ef29-4c88-853d-d32fcc9df357%40googlegroups.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/38617c31-2932-4642-a70f-56ba26d74ea4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
