zaproxy: unable to find image 'in:latest' locally

不羁岁月 提交于 2020-05-15 09:46:25

问题


I followed example from : https://zaproxy.blogspot.com/2017/06/scanning-apis-with-zap.html

  1. install Docker on my Mac
  2. executed docker pull owasp/zap2docker-weekly
  3. executed example: docker run -t owasp/zap2docker-weekly zap-api-scan.py -t \ https://www.example.com/openapi.json -f openapi it works
  4. executed my command to scan my API : docker run -v /etc/hosts:/etc/hosts -v $(pwd):/zap/wrk:rw -t owasp/zap2docker-weekly zap-api-scan.py -t myapitest.json -f openapi And I got: Unable to find image 'in:latest' locally docker: Error response from daemon: pull access denied for in, repository does not exist or may require 'docker login'. I googled to find the solution, as I'm novice both in Docker and ZAP, but in vain.

回答1:


Your current working directory likely has spaces in its path. Because of this, -v $(pwd):/zap/wrk:rw is seen as two arguments, and the second one is seen as name of the image to run.

For example:

# create a directory having spaces, last part is "baz"
mkdir foo\ bar\ baz

# change to that directory
cd foo\ bar\ baz

# attempt to run a container that bind-mounts the current
# directory, and see that it's producing an error:
docker run --rm -v $(pwd):/foo busybox

Unable to find image 'bar:latest' locally
docker: Error response from daemon: pull access denied for bar, repository does not exist or may require 'docker login'.

What's happening, is that $(foo) is expanded to its full path:

pwd
/Users/sebastiaan/Projects/spaces/foo bar baz

So, running the docker command actually runs:

docker run --rm -v  /Users/sebastiaan/Projects/spaces/foo bar baz:/foo busybox

And docker sees bar as the name of the image you're trying to run

To work around this, put quotes around $(pwd);

docker run --rm -v "$(pwd)":/foo busybox


来源:https://stackoverflow.com/questions/49493851/zaproxy-unable-to-find-image-inlatest-locally

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!