TransWikia.com

Docker compose errror when mounting the volumes

Server Fault Asked by zetacu on December 20, 2021

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.

2 Answers

This can happen when something in your Dockerfile creates a bin/develop.sh that doesn't exist in your host directory. The other possibility is the script on your host may have windows linefeeds, and so /bin/sh instead looks for /bin/sh<cr> and the later file does not exist.

Answered by BMitch on December 20, 2021

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).

Answered by iwaseatenbyagrue on December 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP