"Build an Image" Docker tutorial not working with Packer docker image

Hi all,

I’m trying to go through the Packer tutorial on building a Docker image.
(Build an Image | Packer - HashiCorp Learn)
This works on my system when Packer is directly installed in the environment but doesn’t work if i try using the Hashicorp Packer docker container (Docker Hub)
When running through the tutorial i can generate a docker image from the .pkr.hcl file.
Doing the same as stated in the tutorial, but using the packer docker image i get the following result.

$ docker run -v `pwd`:/workspace -w /workspace -e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins hashicorp/packer:latest init .
Installed plugin github.com/hashicorp/docker v1.0.5 in "/workspace/.packer.d/plugins/github.com/hashicorp/docker/packer-plugin-docker_v1.0.5_x5.0_linux_amd64"
$ docker run -v `pwd`:/workspace -w /workspace -e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins hashicorp/packer:latest fmt .
$ docker run -v `pwd`:/workspace -w /workspace -e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins hashicorp/packer:latest validate .
The configuration is valid.
$ docker run -v `pwd`:/workspace -w /workspace -e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins hashicorp/packer:latest build .
learn-packer.docker.ubuntu: output will be in this color.

Build 'learn-packer.docker.ubuntu' errored after 917 microseconds: exec: "docker": executable file not found in $PATH

==> Wait completed after 989 microseconds

==> Some builds didn't complete successfully and had errors:
--> learn-packer.docker.ubuntu: exec: "docker": executable file not found in $PATH

==> Builds finished but no artifacts were created.

My .pkr.hcl file is the same as the one in “Write packer template” part of the tutorial. Build an Image | Packer - HashiCorp Learn

I’m wondering why I keep getting this error. Am i missing something here?

“docker”: executable file not found in $PATH

As stated earlier, the problem only occurs when using the packer docker image. Using the installed version of Packer seems to work without problems.

$ packer init .
$ packer fmt .
$ packer validate .
The configuration is valid.
$ packer build .
learn-packer.docker.ubuntu: output will be in this color.

==> learn-packer.docker.ubuntu: Creating a temporary directory for sharing data...
==> learn-packer.docker.ubuntu: Pulling Docker image: ubuntu:xenial
    learn-packer.docker.ubuntu: xenial: Pulling from library/ubuntu
    learn-packer.docker.ubuntu: Digest: sha256:20858ebbc96215d6c3c574f781133ebffdc7c18d98af4f294cc4c04871a6fe61
    learn-packer.docker.ubuntu: Status: Image is up to date for ubuntu:xenial
    learn-packer.docker.ubuntu: docker.io/library/ubuntu:xenial
==> learn-packer.docker.ubuntu: Starting docker container...
    learn-packer.docker.ubuntu: Run command: docker run -v /home/cis/.config/packer/tmp3121193182:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:xenial
    learn-packer.docker.ubuntu: Container ID: 6a60a71a03f0def89550f4644a722f9ccf62d4bb31316f8abc04cb7f9e766843
==> learn-packer.docker.ubuntu: Using docker communicator to connect: 172.17.0.2
==> learn-packer.docker.ubuntu: Committing the container
    learn-packer.docker.ubuntu: Image ID: sha256:60afb0bc072c2e55c336cc02c5366b548b0186eda55a1fb1f88d01628d76bc1c
==> learn-packer.docker.ubuntu: Killing the container: 6a60a71a03f0def89550f4644a722f9ccf62d4bb31316f8abc04cb7f9e766843
Build 'learn-packer.docker.ubuntu' finished after 2 seconds 506 milliseconds.

==> Wait completed after 2 seconds 506 milliseconds

==> Builds finished. The artifacts of successful builds are:
--> learn-packer.docker.ubuntu: Imported Docker image: sha256:60afb0bc072c2e55c336cc02c5366b548b0186eda55a1fb1f88d01628d76bc1c