Directory created inside docker container not reflecting on host machine

倖福魔咒の 提交于 2019-12-13 03:55:28

问题


I am beginner in docker. I am trying to create docker container and there is one folder with name 'data'. When container starts then it is expected to create folder inside data with name "logs" and "hive". And these folder should reflect on host machine directory as I am specifying in docker-compose.yml file.

When I went to docker container there file system is like

/usr/src/app # ls ./data
hive  logs
/usr/src/app #

Following is my docker-compose configuration for volume

`volumes:
    - ./data/:/app/usr/data/`

On my host machine only "data" folder is created. but hive and logs are not created.


回答1:


You made a small mistake with your compose file wrongly mapping the locations, you can fix it by:

volumes:
    - ./data/:/usr/src/app/data/

Now you on-host data folder is pointed to a /usr/src/app/data inside container.



来源:https://stackoverflow.com/questions/51192119/directory-created-inside-docker-container-not-reflecting-on-host-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!