Hi Matthew,

Yes, you can specify the chroot_path parameter in your Packer configuration 
to set the working directory where Packer will execute the Docker build 
command.
Here's an updated example Packer configuration file that sets the 
chroot_path to $BITBUCKET_CLONE_DIR:

​Thanks,
Hannah Bekar

https://limaxlock.com

On Thursday, November 17, 2022 at 1:19:14 AM UTC+5:30 Matthew Neirynck 
wrote:

> Hi,
> I'm trying to build a docker image using packer in a Bitbucket Pipeline 
> like so:
> *- **step: &build*
> * image: hashicorp/packer*
> * services:*
> * - docker*
> * script:*
> * - export AWS_DEFAULT_REGION=$AWS_REGION*
> * - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID*
> * - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY*
> * - packer --version*
> * - packer build -var 'version=$DOCKER_TAG' cicd/packer/packer.pkr.hcl*
>
> But this fails with the following error:
> *==> docker.telsy: Starting docker container...*
> * docker.telsy: Run command: docker run -v 
> /root/.config/packer/tmp3980589757:/packer-files -d -i -t 
> --entrypoint=/bin/sh -- ubuntu:20.04*
> *==> docker.telsy: Error running container: Docker exited with a non-zero 
> exit status.*
> *==> docker.telsy: Stderr: docker: Error response from daemon: 
> authorization denied by plugin pipelines: -v only supports 
> $BITBUCKET_CLONE_DIR and its subdirectories.*
>
> Is there a way to specify in Packer not to use the default path to mount 
> into the container, but rather the BITBUCKET_CLONE_DIR?
>

-- 
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/hashicorp/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/5a25537d-4315-4a8d-96c1-d9ac9e2f93f6n%40googlegroups.com.

Reply via email to