【问题标题】:Unable to run local collection on docker image无法在 docker 映像上运行本地集合
【发布时间】:2021-01-21 11:03:39
【问题描述】:

我是 docker 的新手,但是我遇到了各种关于如何在 docker 上运行本地集合的博客,但我仍然收到错误,任何帮助将不胜感激。我想在 newman 映像上安装以下内容

docker run -v /C:/Users/name.surname/collection:/etc/postman -t postman/newman_ubuntu1404 \run “https:/www.getpostman.com/collections/xxxxx” --environment=“测试.postman_environment.json” ----ssl-client-cert test.cer --ssl-client-key test.key --insecure --testReportFile=“newman-report.xml”

我得到的错误如下 docker: Error response from daemon: invalid mode: /etc/postman.

不幸的是,我似乎不明白这个错误来解决它。

【问题讨论】:

    标签: docker ssl-certificate postman newman


    【解决方案1】:

    卷挂载绑定的格式是-v <source>:<destination>:<mode> 模式可以是可选的,不必传递。问题出在您的源代码中,您传入了一个冒号,它是卷属性中字段的分隔符。

    -v /C<:>/Users/msingathi.majola/collection<:>/etc/postman

    我将你的冒号包裹在 < > 中只是为了突出显示它们,但正如你所看到的那样,它会读作

    src = /C
    dest= /Users/msingathi.majola/collection
    mode= /etc/postman
    

    这就是您收到错误invalid mode: /etc/postman 的原因。您应该改为使用 --mount 显式指定音量参数。

    【讨论】:

    • 嗨,克里斯,感谢您的回复,我现在刚刚尝试过这种方式,但仍然收到错误 'docker run -v /c/Users/msingathi.majola/collection /etc/postman -t postman /newman_ubuntu1404 \运行“https://www.getpostman.com/collections/xxxxx” --environment=“Test.postman_environment.json” ----ssl-client-cert test.cer --ssl-client-key 测试。 key --insecure --testReportFile="newman-report.xml"'' --mount 命令也会抛出错误。请指教。
    • 你没有展示你是如何使用mount的。语法将是 --mount type=bind, src=<your source>, dst=<your dest> 应该替换您的卷部分。当您将源和目标作为单独的键传递时,它将删除源或目标中包含冒号的任何问题,而不是传递卷将通过冒号解析和拆分的单个字符串
    • 好吧,抱歉,不够详细,只是把我的头绕在这个问题上。我使用了以下格式 'docker run -v --mount type=bind, src=C/Users/msingathi.majola/collection, dst=/etc/newman -t postman/newman run "https://www.getpostman.com /collections/xxx" -- --environment="Test.postman_environment.json" --ssl-client-cert test.cer --ssl-client-key test.key --insecure --testReportFile="newman-report. xml"' 我得到一个无效的参考格式
    • 你不用-v和--mount,mount代替需要通过-v。并且键值参数之间没有任何空格。看起来你在使用 windows,你确定你的路径的格式/语法是正确的吗?
    • 是的,这是我在本地机器上的路径
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-03
    • 2019-04-10
    • 2021-11-27
    • 1970-01-01
    • 2019-06-02
    相关资源
    最近更新 更多