使用docker-compose方式启动容器,提示Nosuchfileordirectory,我怀疑是不是这里错了,docker-compose.yml如下:version:"3.1"services:php:image:php:7.1.7-clivolumes:-.:/opt/phpprivileged:truecommand:["/opt/php/docker/test_runner.sh"]这里volumes想表达的是当前目录跟镜像中的/opt/php目录做共享,但是windows下可能不是这样写,试了./也不行,求解!具体报错如下:PSC:\Users\tanteng\website\DesignPatternsPHP>docker-composeupStartingdesignpatternsphp_php_1...Startingdesignpatternsphp_php_1...doneAttachingtodesignpatternsphp_php_1:Nosuchfileordirectorydesignpatternsphp_php_1exitedwithcode127
2 回答
慕容森
TA贡献1853条经验 获得超18个赞
给你看看我的nginx配置:services:nginx:image:"nginx:alpine"container_name:oxf-nginxrestart:on-failureports:-"80:80"volumes:-./data/conf/nginx.conf:/etc/nginx/nginx.conf-./data/html/:/usr/share/nginx/html-./data/log/:/var/log/nginxenvironment:-NGINX_PORT=80command:nginx-g'daemonoff;'目录树如下:.├──data│ ├──conf│ │ └──nginx.conf│ ├──html│ │ ├──index.html│ │ ├──test│ │ │ ├──index.html│ │ │ ├──test.htm│ │ │ └──test.html│ │ └──test.htm│ └──log│ ├──access.log│ └──error.log└──docker-compose.yaml
潇潇雨雨
TA贡献1833条经验 获得超4个赞
Windows或者Linux下,我一般都是直接写的绝对路径同时也建议写成完整路径,这些看起来更加清晰易懂volumes:-H:/code:/webser/www#H是盘符,H:/code是Windows共享目录
添加回答
举报
0/150
提交
取消