gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 08:08:18 26 4
gpt4 key购买 nike

我遵循了以下示例: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”docker:来自守护进程的错误响应:拉取访问被拒绝,存储库不存在或可能需要“docker login”。我用谷歌搜索找到了解决方案,因为我在 Docker 和 ZAP 方面都是新手,但没有成功。

最佳答案

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

例如:

# 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) 被扩展到它的完整路径:

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

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

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

并且 docker 将 bar 视为您尝试运行的图像的名称

要解决这个问题,请在 $(pwd) 周围加上引号;

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

关于docker - zaproxy : unable to find image 'in:latest' locally,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49493851/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com