I'm following the Docker Compose getting started guide (https://docs.docker.com/compose/gettingstarted/) and I've followed the guide exactly. My Dockerfile
, docker-compose.yml
, and all other files in the directory are exactly as they appear in the guide.
However, when I attempt to run docker-compose up
, the web service exits immediately with an exit code of 2, and an error message:
web_1 | python: can't open file 'app.py': [Errno 2] No such file or directory
Building and running an image works fine if the run by itself, i.e.
docker build -t composetestweb .
docker run -d -p 5000:5000 composetestweb
The website spits out an error, but it does respond.
Inspecting the composed container appears to present the correct information: the command, mounted folders, and working directory are all correct.
I'm using Docker Machine on Windows 7 with VirtualBox 4.3.38. For the record, I haven't had any problems with any other Docker guides up to this point.
The most common cause of this error is using
docker-machine
and a project output of your$HOME
directory.docker-machine
will only create a Virtualbox shared folder for the home directory, so if your project is outside of that directory thevolumes:
used in thedocker-compose
will not work.You have the following options:
volumes:
, removing it from thedocker-compose