Use changes and ENV to set the PATH, see https://www.packer.io/docs/builders/docker.html#basic-example-changes-to-metadata
On Mar 8, 2018 7:00 PM, "Alvaro Miranda Aguilera" <kiki...@gmail.com> wrote: > where packer fits here ? > > On Thu, Mar 8, 2018 at 6:02 PM, Ivan Ribakov <ivan.ribak...@gmail.com> > wrote: > >> I'm building a docker image and using Ansible for provisioning. I would >> like to be able to update image's PATH variable from inside the container >> (I don't need these changes to take effect immediately, as long as they are >> commited to an image and are available later). Is there a way to do it? >> >> To illustrate my point: >> >> $ docker run -itd --name test centos:6 >> $ docker exec -it test /bin/bash >> [root@006a9c3195b6 /]# echo 'echo SUCCESS' > /root/test.sh >> [root@006a9c3195b6 /]# chmod +x /root/test.sh >> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > >> /etc/profile.d/my_settings.sh >> [root@006a9c3195b6 /]# echo 'PATH=/root:$PATH' > /etc/environment >> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > ~/.bashrc >> [root@006a9c3195b6 /]# exit >> $ docker commit test test-image:1 >> $ docker exec -it test-image:1 test.sh >> OCI runtime exec failed: exec failed: container_linux.go:296: starting >> container process caused "exec: \"test.sh\": executable file not found in >> $PATH": unknown >> >> >> However, following works: >> >> $ docker run -it test-image:1 /bin/bash >> [root@8f821c7b9b82 /]# test.sh >> SUCCESS >> >> >> Any ideas as to what I'm doing wrong? >> >> -- >> 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 packer-tool+unsubscr...@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/packer-tool/e4cb8df6-fe4e-48bc-9064-64ce4cabae79%40googlegroups.com >> <https://groups.google.com/d/msgid/packer-tool/e4cb8df6-fe4e-48bc-9064-64ce4cabae79%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 packer-tool+unsubscr...@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/CAHqq0eyK01mTYLZDQmxdz-U%3DWbFj39dFkcNHEDZ883nXukym9Q% > 40mail.gmail.com > <https://groups.google.com/d/msgid/packer-tool/CAHqq0eyK01mTYLZDQmxdz-U%3DWbFj39dFkcNHEDZ883nXukym9Q%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 packer-tool+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt_HK4S5JqaHOWeP7_eQwzT2c35qhzsKy0EZUyt94D1QxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.