zaproxy:无法在本地找到图像“ in:latest” [英] zaproxy: unable to find image 'in:latest' locally

查看:146
本文介绍了zaproxy:无法在本地找到图像“ in:latest”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了以下示例: https:// zaproxy。 blogspot.com/2017/06/scanning-apis-with-zap.html


  1. 在Mac上安装Docker

  2. 执行 docker pull owasp / zap2docker-weekly

  3. 执行的示例: docker run -t owasp / zap2docker-weekly zap-api-scan.py -t \
    https://www.example.com/openapi.json -f openapi

    有效

  4. 执行了我的命令以扫描我的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
    我得到了:
    在本地找到镜像'in:latest'
    泊坞窗:来自守护程序的错误响应:拒绝对in的访问,存储库不存在或可能需要'docker login'。

    解决方案,因为我是Docker和ZAP的新手,但徒劳。

  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.


推荐答案

您当前的工作目录的路径中可能有空格。因此, -v $ {pwd):/ zap / wrk:rw 被视为两个参数,第二个参数被视为要运行的图像的名称。

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.

例如:

# 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'.

发生了什么事,是 $(foo)已扩展为完整路径:

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

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

因此,运行docker命令实际上会运行:

So, running the docker command actually runs:

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

然后docker看到 bar 作为您要运行的映像的名称

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

要解决此问题,请在 $(pwd)前后加上引号;

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

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

这篇关于zaproxy:无法在本地找到图像“ in:latest”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆