I've been struggling to get a Docker image up and running on Windows 10 Home, using Docker Toolbox. Here is the error that I see in Kitematic:
python: can't open file 'src/__main__.py': [Errno 2]
No such file or directory
This Python command that is failing is the entry point for the 'notes' Docker container.
After Docker/up.sh the process finishes without any errors.
Successfully built f59c275721cf
Successfully tagged docker_mysql:latest
Creating mysql ... done
Creating notes ... done
Additionally, this is a group project in which other users on Macs aren't able to duplicate this error. After updating Dockerfile to below and running:
Successfully built 42a95cd419f2
Successfully tagged docker_mysql:latest
Creating mysql ... done
Creating notes ... done
User@DESKTOP-EBUI9GE MINGW64 /c/users/user/Desktop/6440/Procedure-Notes-Application (master)
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
68f60fdba6f5 docker_mysql "docker-entrypoint.s…" 15 seconds ago Up 9 seconds 0.0.0.0:23306->3306/tcp mysql
User@DESKTOP-EBUI9GE MINGW64 /c/users/user/Desktop/6440/Procedure-Notes-Application (master)
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7fbd5b73189 docker_notes "python /app/src/__m…" 23 seconds ago Exited (2) 17 seconds ago notes
68f60fdba6f5 docker_mysql "docker-entrypoint.s…" 23 seconds ago Up 17 seconds 0.0.0.0:23306->3306/tcp mysql
Updated Dockerfile:
### Use an official Python runtime as a parent image
FROM python:2.7-slim
### set working directory to the code location
WORKDIR /app
### copy the code base over (redone by the compose file)
COPY . .
### Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
### Make port available to the world outside this container
EXPOSE 5000
### start the application
CMD ["python", "/app/src/__main__.py"]
I am now getting another error:
* Serving Flask app "__main__" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
Traceback (most recent call last):
File "/app/src/__main__.py", line 57, in <module>
app.run(debug=True, host='0.0.0.0')
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 943, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 988, in run_simple
run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
File "/usr/local/lib/python2.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
sys.exit(reloader.restart_with_reloader())
File "/usr/local/lib/python2.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
exit_code = subprocess.call(args, env=new_environ, close_fds=False)
File "/usr/local/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/local/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/local/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
volumes
entry that mounts from a local directory that you don't have, or perhaps bad ADD/WORKDIR in the Dockerfile?mkdir
, as WORKDIR will create it. It's also better to use absolute references, such asWORKDIR /app
andCMD ["python", "/app/src/__main__.py"]
.