node.js 使用图像,跳过(docker-compose)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47615495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
uses an image, skipping (docker-compose)
提问by Dora
I am currently trying out this tutorial for node expresswith mongodbhttps://medium.com/@sunnykay/docker-development-workflow-node-express-mongo-4bb3b1f7eb1e
我目前正在node express使用https://medium.com/@sunnykay/docker-development-workflow-node-express-mongo-4bb3b1f7eb1e试用本教程mongodb
the first part works fine where to build the docker-compose.ymlit works totally find building it locally so I tried to tag it and push into my dockerhubto learn and try more.
第一部分工作正常,在哪里构建docker-compose.yml它完全可以找到在本地构建它,所以我尝试标记它并推进我dockerhub的学习和尝试更多。
this is originally what's in the ymlfile followed by the tutorial
这最初是yml文件中的内容,然后是教程
version: "2"
services:
web:
build: .
volumes:
- ./:/app
ports:
- "3000:3000"
this works like a charm when I use docker-compose buildand docker-compose up
当我使用docker-compose build和时,这就像一个魅力docker-compose up
so I tried to push it to my dockerhub and I also tag it as node-test
所以我试着把它推送到我的 dockerhub 并且我也把它标记为 node-test
I then changed the ymlfile into
然后我将yml文件更改为
version: "2"
services:
web:
image: "et4891/node-test"
volumes:
- ./:/app
ports:
- "3000:3000"
then I removed all images I have previously to make sure this also works...but when I run docker-compose buildI see this message error: web uses an image, skippingand nothing happens.
然后我删除了我以前拥有的所有图像以确保这也有效...但是当我运行时docker-compose build我看到此消息error: web uses an image, skipping并且没有任何反应。
I tried googling the error but nothing much I can find.
我尝试谷歌搜索错误,但我找不到太多。
Can someone please give me a hand?
有人可以帮我吗?
Thanks in advance
提前致谢
回答by Dora
I found out, I was being stupid.
我发现了,我傻了。
I didn't need to run docker-compose buildI can just directly run docker-compose upsince then it'll pull the images down, the buildis just to build locally
我不需要运行docker-compose build我可以直接运行,docker-compose up因为它会拉下图像,build只是在本地构建
回答by Sara Vaseei
in my case below command worked:
在我的情况下,以下命令有效:
docker-compose up --force-recreate
I hope this helps!
我希望这有帮助!
回答by avivamg
Clarification:This message (<service> uses an image, skipping)
is NOT an error. It's informing the user that the service uses Imageand it's therefore pre-built, So it's skipped by the build command.
说明:此消息 ( <service> uses an image, skipping) 不是错误。它通知用户该服务使用Image,因此它是pre-built,因此它被 build 命令跳过。
In other words - You don't need build , you need to upthe service.
换句话说 - 你不需要 build ,你需要up服务。
Solution:run sudo docker-compose up <your-service>
解决方法:运行sudo docker-compose up <your-service>

