Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage tutorial on OSX raises "can't open file 'app.py': [Errno 2] No such file or directory" #300

Closed
tillda opened this issue Jul 9, 2014 · 12 comments

Comments

@tillda
Copy link

tillda commented Jul 9, 2014

On my OSX (10.9, Docker 1.1.0, boot2docker 1.1.0) the tutorial that is on Fig homepage (http://orchardup.github.io/fig/) gives a following log resulting in exit code 2 (see end).

I'm not sure what to do, because I don't use python at all and I'm new to Docker..

It looks like the /code dir is not created, because docker run cdc18ed4ed6f ls /code results in cannot access /code: No such file or directory.

Downloading/unpacking flask (from -r requirements.txt (line 1))
  Running setup.py (path:/tmp/pip_build_root/flask/setup.py) egg_info for package flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking redis (from -r requirements.txt (line 2))
  Running setup.py (path:/tmp/pip_build_root/redis/setup.py) egg_info for package redis

    warning: no previously-included files found matching '__pycache__'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
Downloading/unpacking Werkzeug>=0.7 (from flask->-r requirements.txt (line 1))
  Running setup.py (path:/tmp/pip_build_root/Werkzeug/setup.py) egg_info for package Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
Downloading/unpacking Jinja2>=2.4 (from flask->-r requirements.txt (line 1))
  Running setup.py (path:/tmp/pip_build_root/Jinja2/setup.py) egg_info for package Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
Downloading/unpacking itsdangerous>=0.21 (from flask->-r requirements.txt (line 1))
  Running setup.py (path:/tmp/pip_build_root/itsdangerous/setup.py) egg_info for package itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking markupsafe (from Jinja2>=2.4->flask->-r requirements.txt (line 1))
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py (path:/tmp/pip_build_root/markupsafe/setup.py) egg_info for package markupsafe

Installing collected packages: flask, redis, Werkzeug, Jinja2, itsdangerous, markupsafe
  Running setup.py install for flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
  Running setup.py install for redis

    warning: no previously-included files found matching '__pycache__'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
  Running setup.py install for Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
  Running setup.py install for Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
  Running setup.py install for itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
  Running setup.py install for markupsafe

    building 'markupsafe._speedups' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/markupsafe/_speedups.o -o build/lib.linux-x86_64-2.7/markupsafe/_speedups.so
Successfully installed flask redis Werkzeug Jinja2 itsdangerous markupsafe
Cleaning up...
 ---> 98171080b029
Removing intermediate container f5c9f0ac9513
Successfully built 98171080b029
Attaching to figtest_redis_1, figtest_web_1
redis_1 | error: "Read-only file system" setting key "vm.overcommit_memory"
redis_1 | [10] 09 Jul 06:35:13.046 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
redis_1 | [10] 09 Jul 06:35:13.046 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
redis_1 | [10] 09 Jul 06:35:13.046 # Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
redis_1 |                 _._
redis_1 |            _.-``__ ''-._
redis_1 |       _.-``    `.  `_.  ''-._           Redis 2.8.9 (00000000/0) 64 bit
redis_1 |   .-`` .-```.  ```\/    _.,_ ''-._
redis_1 |  (    '      ,       .-`  | `,    )     Running in stand alone mode
redis_1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
redis_1 |  |    `-._   `._    /     _.-'    |     PID: 10
redis_1 |   `-._    `-._  `-./  _.-'    _.-'
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
redis_1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|
redis_1 |  |    `-._`-._        _.-'_.-'    |
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'
redis_1 |       `-._    `-.__.-'    _.-'
redis_1 |           `-._        _.-'
redis_1 |               `-.__.-'
redis_1 |
redis_1 | [10] 09 Jul 06:35:13.049 # Server started, Redis version 2.8.9
redis_1 | [10] 09 Jul 06:35:13.049 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | [10] 09 Jul 06:35:13.049 * The server is now ready to accept connections on port 6379
web_1   | python: can't open file 'app.py': [Errno 2] No such file or directory
figtest_web_1 exited with code 2
Gracefully stopping... (press Ctrl+C again to force)
Stopping figtest_redis_1...
@bfirsh
Copy link

bfirsh commented Jul 11, 2014

Fig doesn't work with boot2docker, unfortunately. docker-osx is the best solution currently, which the Fig install instructions suggest: http://orchardup.github.io/fig/install.html

There are also some workarounds for boot2docker: #26

@bfirsh bfirsh closed this as completed Jul 11, 2014
@mingderwang
Copy link

@aanand
Copy link

aanand commented Aug 8, 2014

@mingderwang New URL is http://www.fig.sh/install.html.

@panta
Copy link

panta commented Jan 17, 2015

Official instructions for fig now recommend to install boot2docker through the OSX Installer. Following the instructions and the tutorial gives the exact same error:

web_1 | python: can't open file 'app.py': [Errno 2] No such file or directory

I've tried both with the official Docker for OSX Installer and the Homebrew versions of boot2docker and docker. The result is the same.

The versions I tried are:

$ boot2docker version
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb

$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8

$ fig --version
fig 1.0.1

Are there any workarounds?

@aanand
Copy link

aanand commented Jan 19, 2015

@panta Looks like your folders aren't mounting inside the VM. Test it with:

$ boot2docker ssh ls /Users

If the output doesn't list the /Users directory on your Mac, there's something wrong with your boot2docker installation - perhaps try an uninstall/reinstall.

@panta
Copy link

panta commented Jan 20, 2015

The ls seems to work correctly:

$ boot2docker ssh ls /Users
...
panta
...

But your suggestion gave me a possible insight. My home directory /Users/panta is actually a symlink to a directory on a different volume:

$ echo $HOME
/Volumes/UsersHD/panta
$ ls -la /Users/panta
lrwxr-xr-x  1 panta  staff  22 Apr 10  2014 /Users/panta -> /Volumes/UsersHD/panta

So I tried

$ boot2docker ssh ls /Users/panta/
prj

it lists only the leading directory of the project. All the project path components can be listed, except the last:

$ boot2docker ssh ls `pwd`

which gives an empty output.

Could be the problem related to my home residing on a different volume? Is there a workaround in this case?

@aanand
Copy link

aanand commented Jan 22, 2015

That's almost certainly the issue. You might be able to fix it by passing a custom share to boot2docker init with the --vbox-share option:

$ boot2docker destroy
$ boot2docker init --vbox-share="/Volumes/UsersHD/panta=/Users/panta"
$ boot2docker up
$ boot2docker ssh ls /Users/panta

@phuna
Copy link

phuna commented Apr 28, 2015

Hi, I got the same problem when running flask example from docker-compose's tutorial.
The thing I don't understand is that if I run docker run --rm composeflask_web ls -l /code it shows all files as expected:

total 16
-rw-r--r-- 1 root root  78 Apr 28 15:16 Dockerfile
-rw-r--r-- 1 root root 313 Apr 28 15:16 app.py
-rw-r--r-- 1 root root 133 Apr 28 15:17 docker-compose.yml
-rw-r--r-- 1 root root  12 Apr 28 15:16 requirements.txt

That means web container is correctly built and app.py exists inside it. So command option inside docker-compose.yml is used for running command on docker's host not on docker container, right?
Currently the document said command is for "Override the default command." so I think it is used for overriding the default command of the container which means it should be run inside the container.

My environment is:
Mac 10.10.3, docker 1.6.0, boot2docker 1.6.0

@aanand
Copy link

aanand commented Apr 29, 2015

@phuna Your container has built correctly, but if your home directory isn't mounting properly inside the VM, it'll overwrite /code inside the container with an empty directory. What happens if you run this command inside your project directory?

$ boot2docker ssh ls `pwd`

@phuna
Copy link

phuna commented Apr 29, 2015

@aanand It returns only Work which is the leading directory of the project. I also put my home on another volume and link back to /Users/ like @panta so I think I got the same problem with him.
I've checked the docker-compose.yml and see that there is:

  volumes:
   - .:/code

I remove above 2 lines and expect it will use /code of the container, but it still complains that app.py is missing.

@aanand
Copy link

aanand commented Apr 29, 2015

@phuna Make sure your old containers are gone first:

$ docker-compose kill
$ docker-compose rm

@phuna
Copy link

phuna commented Apr 29, 2015

@aanand Thanks! It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants