Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker volume mount: "no such file or directory"

Tags:

docker

I'm pretty new to Docker and trying to get my first (real) image up-and-running. I've written my Dockerfile:

WORKDIR /myapp
VOLUME /myapp/configuration
VOLUME /etc/asterisk
VOLUME /usr/share/asterisk/sounds

So my container should start in /myapp and I should be able to mount external volumes to configure my app (configuration), Asterisk and its sounds.

Though, when I start a container with my image:

docker run -it \
--entrypoint /bin/bash myapp \
-v $(pwd)/asterisk:/etc/asterisk \
-v $(pwd)/configuration:/myapp/configuration \
-v $(pwd)/asterisk/sounds:/usr/share/asterisk/sounds

It gives me the following error:

/bin/bash: /home/me/Docker/asterisk:/etc/asterisk: No such file or directory

I really don't understand why. I've verified it was not a line-ending issue (CRLF rather than expected LF for example), and it's not. I really don't know.

If it counts, I'm running elementary OS Loki.

Please suggest.

like image 443
Thomas Kowalski Avatar asked Aug 01 '18 08:08

Thomas Kowalski


1 Answers

I found what the problem was, my hint was the unusual /bin/bash beginning the line.

Actually, it was interpreting my -v options as options for the entrypoint, and bash didn't understand it.

I moved my lines (--entrypoint is now the last option) and it works like a charm.

like image 153
Thomas Kowalski Avatar answered Oct 24 '22 02:10

Thomas Kowalski