ZAP Docker Image Creation

413 views
Skip to first unread message

praveen pb

unread,
Sep 5, 2022, 9:44:54 AM9/5/22
to OWASP ZAP User Group
Hello Team,

While trying to create the OWASP ZAP Docker Image locally , we are getting the below error.
Using the Docker File of Stable version.

Thanks in advance.

Error :
Removing intermediate container daf7345d16ab
 ---> 028526b1ec6c
Step 30/42 : ENV LANG=C.UTF-8
 ---> Running in ac0690c12c2b
Removing intermediate container ac0690c12c2b
 ---> 6b6a01ca05b8
Step 31/42 : COPY zap* CHANGELOG.md /zap/
COPY failed: file not found in build context or excluded by .dockerignore: stat CHANGELOG.md: file does not exist
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

thc...@gmail.com

unread,
Sep 5, 2022, 12:25:59 PM9/5/22
to zaprox...@googlegroups.com
Hi.

Provide the command you are using to create the image, the file exists:
https://github.com/zaproxy/zaproxy/blob/a02bfb3bf00144b059d99b9e5668dd6adb64ff71/docker/CHANGELOG.md

Best regards.

praveen pb

unread,
Sep 7, 2022, 1:18:15 PM9/7/22
to OWASP ZAP User Group
Hello Team,

Error at below step during the image creation.


WORKDIR /zap

COPY --from=builder /zap .

COPY policies /home/zap/.ZAP/policies/ -----Error during the copy step.

Step 10/19 : COPY --from=builder /zap .
 ---> 360bb77036a3
Step 11/19 : COPY policies /home/zap/.ZAP/policies/
COPY failed: file not found in build context or excluded by .dockerignore: stat policies: file does not exist
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

Could you please has to what could be the issue ?

thc...@gmail.com

unread,
Sep 7, 2022, 1:22:37 PM9/7/22
to zaprox...@googlegroups.com
You are not providing the command used to create the image.

Note that you need to have the files that are under the docker directory.

Best regards.
Message has been deleted

praveen pb

unread,
Sep 8, 2022, 11:41:03 AM9/8/22
to OWASP ZAP User Group
Hello Team,

Presently we are creating the Image to deploy into GKE, using concourse. Not sure if we have to  upload  files manually . Since we are having the above errors during docker file execution. The files are not being copied. Should change the path or any other option to follow

Could you please help us resolve the issue

Simon Bennetts

unread,
Sep 8, 2022, 12:11:33 PM9/8/22
to OWASP ZAP User Group
All of our docker generation scripts are publicly available and are run regularly.
They work for the purposes for which they were intended.
If you have problems building the standard ZAP docker images then tell us exactly what you are doing and what problems you are having.
You are of course free to build you own ZAP images in whatever way you like, but I'm not sure how we can be expected to support them :P

Cheers,

Simon

praveen pb

unread,
Sep 8, 2022, 12:24:55 PM9/8/22
to OWASP ZAP User Group
Hello Simon,

Thanks for the quick reply.

1) Using the ZAP Dockerfile - Bare , we are trying to build a image for the CI pupose.
2) During the image creation process it is failing at the copy step, error below :

Step 10/19 : COPY --from=builder /zap .
 ---> 360bb77036a3
Step 11/19 : COPY policies /home/zap/.ZAP/policies/
COPY failed: file not found in build context or excluded by .dockerignore: stat policies: file does not exist
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

3) Using the below script we are building the image in GKE :
working_dir=`pwd`
#set -e
echo "Setting config to **********"
#gcloud config set project *************
gcloud config set project ********** --quiet
echo "Setting config is set to **********"
echo "$CLOUD_BUILD_KEY" > /tmp/key.json

gcloud auth activate-service-account --key-file=/tmp/key.json  --project=*************
#gcloud beta container clusters get-credentials ******** --region=********* --project=*********
echo " Logged in with Service Account"


image_tag=gcr.io/*************************

echo '########'
echo "Current working directory path is -${working_dir}"
echo '########'
echo ${image_tag}
echo '########'
echo "app repo path is - ${application_repo}"
echo '########'

gcloud builds submit ${application_repo}/ci/run/DockerZAP/. --tag ${image_tag}

echo 'COMPLETED gcloug builds submit'
#echo 'creating container Master image tag'

#gcloud --quiet beta container images add-tag ${image_tag} gcr.io/**************************/ZAP:latest || true
Reply all
Reply to author
Forward
0 new messages