首页 > 解决方案 > Docker - 在本地磁盘上找不到模块说明符“...”

问题描述

我无法将本地文件夹挂载到 docker-compose 上的 docker 卷,因此无法在 docker-compose run cmd 上访问它。

这是来自 github 的回购https://github.com/up1/demo-k6-docker

当我按照自述文件时,docker-compose run k6 run scripts/sample.js它总是给我以下错误:

WARN[0000] The moduleSpecifier "scripts/sample.js" has no scheme but we will try to resolve it as remote module. This will be deprecated in the future and all remote modules will need to explicitly use "https" as scheme. ERRO[0000] The moduleSpecifier "scripts/sample.js" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker. Additionally it was tried to be loaded as remote module by prepending "https://" to it, which also didn't work. Remote resolution error: "Get "https://scripts/sample.js": dial tcp: lookup scripts on 127.0.0.11:53: no such host"

试过:

我真的很感激一些帮助,用这个把我的头撞在墙上几天

标签: macosdockerdocker-compose

解决方案


尝试这个。

docker-compose run k6 run //scripts//sample.js

我在 docker desktop version 3.1.0 Windows 10 pro 上运行。

解决方案


推荐阅读