装载的卷在容器内为空 [英] Mounted volume is empty inside container
本文介绍了装载的卷在容器内为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的 docker-compose.yml
:
db:
image: mongo:latest
ports:
- "27017:27017"
server:
image: artificial/docker-sails:stable-pm2
command: sails lift
volumes:
- server/:/server
ports:
- "1337:1337"
links:
- db
server/
相对于 docker-compose.yml
文件的文件夹.但是,当我 docker exec -it CONTAINERID/bin/bash
并检查 /server
它是空的.
server/
is relative to the folder of the docker-compose.yml
file. However when I docker exec -it CONTAINERID /bin/bash
and check /server
it is empty.
我做错了什么?
推荐答案
尝试使用:
volumes:
- ./server:/server
而不是 server/
-- 在某些情况下 Docker 不喜欢尾部斜杠.
instead of server/
-- there are some cases where Docker doesn't like the trailing slash.
这篇关于装载的卷在容器内为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文