大网数据广告活动
服务器运维问答

Docker compose errror when mounting the volumes

· 52CE 我爱测

In order to see changes in your working directory inside docker, as far as I understand on the docker-compose.yml you need to map the volume to the directory you are going to work. currently I have this web: build: . ports: - "80…

问题原文

原帖链接 · zetacu · CC BY-SA 3.0

In order to see changes in your working directory inside docker, as far as I understand on the docker-compose.yml you need to map the volume to the directory you are going to work.

currently I have this

web:
  build: .
  ports:
   - "8080:8080"
  volumes:
   - .:/data/app

Therefore I'm mapping my machine directory . to the container on the data/app folder, but if I do this I get this error:

ERROR: for web  Cannot start service web: oci runtime error: container_linux.go:247: starting container process caused "exec: \"bin/develop.sh\": stat bin/develop.sh: no such file or directory"
ERROR: Encountered errors while bringing up the project.

If I don't set the volumes tag the container actually boots and all but any change I made into the directory is not transfer to the container.

web:
  build: .
  ports:
   - "8080:8080"

NOTE: this exact same configuration works on my coworkers machines, the server, and even on my mac, the only one giving issues with the volumes is my ubuntu machine and don't understand why.

Docker versions runing on Ubuntu 16.10:

Docker version 17.04.0-ce, build 4845c56
docker-compose version 1.11.2, build dfed245

UPDATE

for CMD I have this ./bin/start.sh which contains

#!/usr/bin/env bash
/usr/bin/supervisord -c ./config/supervisord.conf

In the Docker file I have this

ENV APP_DIR /data/app/
WORKDIR $APP_DIR

And the working directory inside the container is: /data/app.

已采纳解答

原帖链接 · iwaseatenbyagrue · CC BY-SA 3.0

You probably want to replace . with the full path you want to mount into your container.

It may also be worth building an image with your start script included in your image (or, if your script will remain the same as you show in your question, just run supervisord as your CMD, without using the script).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。