Thomas Kowalski
Thomas Kowalski

Reputation: 2184

Docker volume mount: "no such file or directory"

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.

Upvotes: 13

Views: 24575

Answers (1)

Thomas Kowalski
Thomas Kowalski

Reputation: 2184

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.

Upvotes: 19

Related Questions