Flask CLI throws “[Errno 2] No such file” when deploying with dockerCopying files from Docker container to hostCopying files from host to Docker container'FlaskDB' object has no attribute 'sequences'Getting error while trying to run this command “ pipenv install requests ” in mac OSHow to define this command by python click framework?Flask-PyMongo - Object of type InsertOneResult is not JSON serializablepipenv install fails when run inside a containerPipenv not working after upgrade to python (Homebrew installed)flask-ask name 'ask' is not defined when using Blueprints and a separate views.pygetting error while using Flask JWT, AttributeError: 'list' object has no attribute 'id' and shows 500 Internal server error

Are Finite Automata Turing Complete?

Is there any evidence that the small canisters (10 liters) of 95% oxygen actually help with altitude sickness?

Is there any reason to avoid sunglasses with blue lenses?

Links to webpages in books

Calculating the partial sum of a expl3 sequence

Why aren't (poly-)cotton tents more popular?

Go Get the Six Six-Pack

How could mana leakage be dangerous to a elf?

Singing along to guitar chords (harmony)

How can Charles Proxy change settings without admin rights after first time?

Firefox Arm64 available but RapsPi 3B+ still 32 bit

What's the difference between 予定 (Yotei) and 計画 (keikaku)?

Swapping rooks in a 4x4 board

What is this opening trap called, and how should I play afterwards? How can I refute the gambit, and play if I accept it?

Does the Paladin's Aura of Protection affect only either her or ONE ally in range?

How many codes are possible?

Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?

What are the penalties for overstaying in USA?

Origin of 'cuz' as shortening for cousin?

Going to get married soon, should I do it on Dec 31 or Jan 1?

Should I tell my insurance company I'm making payments on my new car?

A player is constantly pestering me about rules, what do I do as a DM?

Are neural networks the wrong tool to solve this 2D platformer/shooter game? Is there a proven way to frame this problem to a neural network?

Why isn’t the tax system continuous rather than bracketed?



Flask CLI throws “[Errno 2] No such file” when deploying with docker


Copying files from Docker container to hostCopying files from host to Docker container'FlaskDB' object has no attribute 'sequences'Getting error while trying to run this command “ pipenv install requests ” in mac OSHow to define this command by python click framework?Flask-PyMongo - Object of type InsertOneResult is not JSON serializablepipenv install fails when run inside a containerPipenv not working after upgrade to python (Homebrew installed)flask-ask name 'ask' is not defined when using Blueprints and a separate views.pygetting error while using Flask JWT, AttributeError: 'list' object has no attribute 'id' and shows 500 Internal server error






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I'm following the micro services course on testdriven.io. In this course I need to deploy a Flask application with Docker. To run the application I use Flask-cli, and it gives me an error on start up:



No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'


To deploy the container I use Docker-compose. I run the command on my Windows 10 machine and I use the standard Python image (python:3.7.2-alpine). I already tried to change the permissions on the file but that didn't help.



This is how my compose file looks like:



version: '3.7'

services:

users:
build:
context: ./services/users
dockerfile: Dockerfile-dev
volumes:
- './services/users:/usr/src/app'
ports:
- 6001:6000
environment:
- FLASK_APP=project/__init__.py
- FLASK_ENV=development
- COMPOSE_CONVERT_WINDOWS_PATHS=1


My docker file:



# base image
FROM python:3.7.2-alpine

# set working directory
WORKDIR /usr/src/app

# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

# add app
COPY . /usr/src/app

# i tried to give it the right rights.. but it didn't help
RUN chmod +x /usr/src/app/manage.py

# run server
CMD python manage.py run -h 0.0.0.0


And my manage.py file which will launch the application:



#!/usr/bin/python3
# services/users/manage.py

from flask.cli import FlaskGroup

from project import app

cli = FlaskGroup(app)

if __name__ == '__main__':
cli()


So i would expect that this would launch the application and make it available on port 6001, but instead it gives me the following error:



Successfully tagged testdriven-app_users:latest
Recreating testdriven-app_users_1 ... done
Attaching to testdriven-app_users_1
users_1 | * Serving Flask app "project/__init__.py" (lazy loading)
users_1 | * Environment: development
users_1 | * Debug mode: on
users_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
users_1 | * Restarting with stat
users_1 | Traceback (most recent call last):
users_1 | File "manage.py", line 11, in <module>
users_1 | cli()
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
users_1 | return self.main(*args, **kwargs)
users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 557, in main
users_1 | return super(FlaskGroup, self).main(*args, **kwargs)
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
users_1 | rv = self.invoke(ctx)
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
users_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
users_1 | return ctx.invoke(self.callback, **ctx.params)
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
users_1 | return callback(*args, **kwargs)
users_1 | File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
users_1 | return ctx.invoke(f, obj, *args, **kwargs)
users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
users_1 | return callback(*args, **kwargs)
users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 771, in run_command
users_1 | threaded=with_threads, ssl_context=cert)
users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/serving.py", line 988, in run_simple
users_1 | run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
users_1 | sys.exit(reloader.restart_with_reloader())
users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
users_1 | exit_code = subprocess.call(args, env=new_environ, close_fds=False)
users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
users_1 | with Popen(*popenargs, **kwargs) as p:
users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
users_1 | restore_signals, start_new_session)
users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
users_1 | raise child_exception_type(errno_num, err_msg, err_filename)
users_1 | FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'
testdriven-app_users_1 exited with code 1









share|improve this question






























    3















    I'm following the micro services course on testdriven.io. In this course I need to deploy a Flask application with Docker. To run the application I use Flask-cli, and it gives me an error on start up:



    No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'


    To deploy the container I use Docker-compose. I run the command on my Windows 10 machine and I use the standard Python image (python:3.7.2-alpine). I already tried to change the permissions on the file but that didn't help.



    This is how my compose file looks like:



    version: '3.7'

    services:

    users:
    build:
    context: ./services/users
    dockerfile: Dockerfile-dev
    volumes:
    - './services/users:/usr/src/app'
    ports:
    - 6001:6000
    environment:
    - FLASK_APP=project/__init__.py
    - FLASK_ENV=development
    - COMPOSE_CONVERT_WINDOWS_PATHS=1


    My docker file:



    # base image
    FROM python:3.7.2-alpine

    # set working directory
    WORKDIR /usr/src/app

    # add and install requirements
    COPY ./requirements.txt /usr/src/app/requirements.txt
    RUN pip install -r requirements.txt

    # add app
    COPY . /usr/src/app

    # i tried to give it the right rights.. but it didn't help
    RUN chmod +x /usr/src/app/manage.py

    # run server
    CMD python manage.py run -h 0.0.0.0


    And my manage.py file which will launch the application:



    #!/usr/bin/python3
    # services/users/manage.py

    from flask.cli import FlaskGroup

    from project import app

    cli = FlaskGroup(app)

    if __name__ == '__main__':
    cli()


    So i would expect that this would launch the application and make it available on port 6001, but instead it gives me the following error:



    Successfully tagged testdriven-app_users:latest
    Recreating testdriven-app_users_1 ... done
    Attaching to testdriven-app_users_1
    users_1 | * Serving Flask app "project/__init__.py" (lazy loading)
    users_1 | * Environment: development
    users_1 | * Debug mode: on
    users_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
    users_1 | * Restarting with stat
    users_1 | Traceback (most recent call last):
    users_1 | File "manage.py", line 11, in <module>
    users_1 | cli()
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    users_1 | return self.main(*args, **kwargs)
    users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 557, in main
    users_1 | return super(FlaskGroup, self).main(*args, **kwargs)
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    users_1 | rv = self.invoke(ctx)
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    users_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    users_1 | return ctx.invoke(self.callback, **ctx.params)
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    users_1 | return callback(*args, **kwargs)
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
    users_1 | return ctx.invoke(f, obj, *args, **kwargs)
    users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    users_1 | return callback(*args, **kwargs)
    users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 771, in run_command
    users_1 | threaded=with_threads, ssl_context=cert)
    users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/serving.py", line 988, in run_simple
    users_1 | run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
    users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
    users_1 | sys.exit(reloader.restart_with_reloader())
    users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
    users_1 | exit_code = subprocess.call(args, env=new_environ, close_fds=False)
    users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
    users_1 | with Popen(*popenargs, **kwargs) as p:
    users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
    users_1 | restore_signals, start_new_session)
    users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
    users_1 | raise child_exception_type(errno_num, err_msg, err_filename)
    users_1 | FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'
    testdriven-app_users_1 exited with code 1









    share|improve this question


























      3












      3








      3








      I'm following the micro services course on testdriven.io. In this course I need to deploy a Flask application with Docker. To run the application I use Flask-cli, and it gives me an error on start up:



      No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'


      To deploy the container I use Docker-compose. I run the command on my Windows 10 machine and I use the standard Python image (python:3.7.2-alpine). I already tried to change the permissions on the file but that didn't help.



      This is how my compose file looks like:



      version: '3.7'

      services:

      users:
      build:
      context: ./services/users
      dockerfile: Dockerfile-dev
      volumes:
      - './services/users:/usr/src/app'
      ports:
      - 6001:6000
      environment:
      - FLASK_APP=project/__init__.py
      - FLASK_ENV=development
      - COMPOSE_CONVERT_WINDOWS_PATHS=1


      My docker file:



      # base image
      FROM python:3.7.2-alpine

      # set working directory
      WORKDIR /usr/src/app

      # add and install requirements
      COPY ./requirements.txt /usr/src/app/requirements.txt
      RUN pip install -r requirements.txt

      # add app
      COPY . /usr/src/app

      # i tried to give it the right rights.. but it didn't help
      RUN chmod +x /usr/src/app/manage.py

      # run server
      CMD python manage.py run -h 0.0.0.0


      And my manage.py file which will launch the application:



      #!/usr/bin/python3
      # services/users/manage.py

      from flask.cli import FlaskGroup

      from project import app

      cli = FlaskGroup(app)

      if __name__ == '__main__':
      cli()


      So i would expect that this would launch the application and make it available on port 6001, but instead it gives me the following error:



      Successfully tagged testdriven-app_users:latest
      Recreating testdriven-app_users_1 ... done
      Attaching to testdriven-app_users_1
      users_1 | * Serving Flask app "project/__init__.py" (lazy loading)
      users_1 | * Environment: development
      users_1 | * Debug mode: on
      users_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
      users_1 | * Restarting with stat
      users_1 | Traceback (most recent call last):
      users_1 | File "manage.py", line 11, in <module>
      users_1 | cli()
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
      users_1 | return self.main(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 557, in main
      users_1 | return super(FlaskGroup, self).main(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
      users_1 | rv = self.invoke(ctx)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
      users_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
      users_1 | return ctx.invoke(self.callback, **ctx.params)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
      users_1 | return callback(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
      users_1 | return ctx.invoke(f, obj, *args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
      users_1 | return callback(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 771, in run_command
      users_1 | threaded=with_threads, ssl_context=cert)
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/serving.py", line 988, in run_simple
      users_1 | run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
      users_1 | sys.exit(reloader.restart_with_reloader())
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
      users_1 | exit_code = subprocess.call(args, env=new_environ, close_fds=False)
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
      users_1 | with Popen(*popenargs, **kwargs) as p:
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
      users_1 | restore_signals, start_new_session)
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
      users_1 | raise child_exception_type(errno_num, err_msg, err_filename)
      users_1 | FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'
      testdriven-app_users_1 exited with code 1









      share|improve this question
















      I'm following the micro services course on testdriven.io. In this course I need to deploy a Flask application with Docker. To run the application I use Flask-cli, and it gives me an error on start up:



      No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'


      To deploy the container I use Docker-compose. I run the command on my Windows 10 machine and I use the standard Python image (python:3.7.2-alpine). I already tried to change the permissions on the file but that didn't help.



      This is how my compose file looks like:



      version: '3.7'

      services:

      users:
      build:
      context: ./services/users
      dockerfile: Dockerfile-dev
      volumes:
      - './services/users:/usr/src/app'
      ports:
      - 6001:6000
      environment:
      - FLASK_APP=project/__init__.py
      - FLASK_ENV=development
      - COMPOSE_CONVERT_WINDOWS_PATHS=1


      My docker file:



      # base image
      FROM python:3.7.2-alpine

      # set working directory
      WORKDIR /usr/src/app

      # add and install requirements
      COPY ./requirements.txt /usr/src/app/requirements.txt
      RUN pip install -r requirements.txt

      # add app
      COPY . /usr/src/app

      # i tried to give it the right rights.. but it didn't help
      RUN chmod +x /usr/src/app/manage.py

      # run server
      CMD python manage.py run -h 0.0.0.0


      And my manage.py file which will launch the application:



      #!/usr/bin/python3
      # services/users/manage.py

      from flask.cli import FlaskGroup

      from project import app

      cli = FlaskGroup(app)

      if __name__ == '__main__':
      cli()


      So i would expect that this would launch the application and make it available on port 6001, but instead it gives me the following error:



      Successfully tagged testdriven-app_users:latest
      Recreating testdriven-app_users_1 ... done
      Attaching to testdriven-app_users_1
      users_1 | * Serving Flask app "project/__init__.py" (lazy loading)
      users_1 | * Environment: development
      users_1 | * Debug mode: on
      users_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
      users_1 | * Restarting with stat
      users_1 | Traceback (most recent call last):
      users_1 | File "manage.py", line 11, in <module>
      users_1 | cli()
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
      users_1 | return self.main(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 557, in main
      users_1 | return super(FlaskGroup, self).main(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
      users_1 | rv = self.invoke(ctx)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
      users_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
      users_1 | return ctx.invoke(self.callback, **ctx.params)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
      users_1 | return callback(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
      users_1 | return ctx.invoke(f, obj, *args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
      users_1 | return callback(*args, **kwargs)
      users_1 | File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 771, in run_command
      users_1 | threaded=with_threads, ssl_context=cert)
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/serving.py", line 988, in run_simple
      users_1 | run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
      users_1 | sys.exit(reloader.restart_with_reloader())
      users_1 | File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
      users_1 | exit_code = subprocess.call(args, env=new_environ, close_fds=False)
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
      users_1 | with Popen(*popenargs, **kwargs) as p:
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
      users_1 | restore_signals, start_new_session)
      users_1 | File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
      users_1 | raise child_exception_type(errno_num, err_msg, err_filename)
      users_1 | FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/app/manage.py': '/usr/src/app/manage.py'
      testdriven-app_users_1 exited with code 1






      python docker flask






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 13:55









      Danila Kiver

      7451 gold badge7 silver badges17 bronze badges




      7451 gold badge7 silver badges17 bronze badges










      asked Mar 25 at 11:01









      Robert van der StarreRobert van der Starre

      215 bronze badges




      215 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          1














          When you execute a script, the kernel looks for the interpreter specified in the shebang (#!). The location of the interpreter is extracted, and then the interpreter (e.g. python3) is launched, executing the script itself. If the interpreter binary is not found, execution fails with a No such file or directory (ENOENT) error (as per man 2 execve):



          ERRORS
          <...>
          ENOENT The file filename or a script or ELF interpreter does not exist,
          or a shared library needed for the file or interpreter cannot be found.


          You have specified #!/usr/bin/python3 in your shebang, but in the base image you use (python:3.7.2-alpine) the python3 binary is at different location:



          $ docker run -it python:3.7.2-alpine sh
          / # which python3
          /usr/local/bin/python3


          So, even if your application works locally at your host (if it is Windows, it probably even does not care about the shebang), it stops working when you move it into the Docker container.



          To avoid such situations, shebangs in scripts usually refer not to the interpreter itself (#!/usr/bin/python3), but to /usr/bin/env binary, which finds and executes the interpreter:



          #!/usr/bin/env python3


          When you run python3 via env, the latter performs the search through PATH, so it allows your shebang not to rely on specific location of python3 binary.



          Finally, the correct version of your script would be as follows:



          #!/usr/bin/env python3
          # services/users/manage.py

          from flask.cli import FlaskGroup

          from project import app

          cli = FlaskGroup(app)

          if __name__ == '__main__':
          cli()





          share|improve this answer

























          • Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

            – Robert van der Starre
            Mar 25 at 14:58


















          1














          add werkzeug==0.14.1 to requirement.txt can fix same bug appear on windows.
          its seems like a werkzeug bug.






          share|improve this answer























          • This fixed mine, thanks.

            – bjk116
            Jun 19 at 1:53













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336316%2fflask-cli-throws-errno-2-no-such-file-when-deploying-with-docker%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          When you execute a script, the kernel looks for the interpreter specified in the shebang (#!). The location of the interpreter is extracted, and then the interpreter (e.g. python3) is launched, executing the script itself. If the interpreter binary is not found, execution fails with a No such file or directory (ENOENT) error (as per man 2 execve):



          ERRORS
          <...>
          ENOENT The file filename or a script or ELF interpreter does not exist,
          or a shared library needed for the file or interpreter cannot be found.


          You have specified #!/usr/bin/python3 in your shebang, but in the base image you use (python:3.7.2-alpine) the python3 binary is at different location:



          $ docker run -it python:3.7.2-alpine sh
          / # which python3
          /usr/local/bin/python3


          So, even if your application works locally at your host (if it is Windows, it probably even does not care about the shebang), it stops working when you move it into the Docker container.



          To avoid such situations, shebangs in scripts usually refer not to the interpreter itself (#!/usr/bin/python3), but to /usr/bin/env binary, which finds and executes the interpreter:



          #!/usr/bin/env python3


          When you run python3 via env, the latter performs the search through PATH, so it allows your shebang not to rely on specific location of python3 binary.



          Finally, the correct version of your script would be as follows:



          #!/usr/bin/env python3
          # services/users/manage.py

          from flask.cli import FlaskGroup

          from project import app

          cli = FlaskGroup(app)

          if __name__ == '__main__':
          cli()





          share|improve this answer

























          • Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

            – Robert van der Starre
            Mar 25 at 14:58















          1














          When you execute a script, the kernel looks for the interpreter specified in the shebang (#!). The location of the interpreter is extracted, and then the interpreter (e.g. python3) is launched, executing the script itself. If the interpreter binary is not found, execution fails with a No such file or directory (ENOENT) error (as per man 2 execve):



          ERRORS
          <...>
          ENOENT The file filename or a script or ELF interpreter does not exist,
          or a shared library needed for the file or interpreter cannot be found.


          You have specified #!/usr/bin/python3 in your shebang, but in the base image you use (python:3.7.2-alpine) the python3 binary is at different location:



          $ docker run -it python:3.7.2-alpine sh
          / # which python3
          /usr/local/bin/python3


          So, even if your application works locally at your host (if it is Windows, it probably even does not care about the shebang), it stops working when you move it into the Docker container.



          To avoid such situations, shebangs in scripts usually refer not to the interpreter itself (#!/usr/bin/python3), but to /usr/bin/env binary, which finds and executes the interpreter:



          #!/usr/bin/env python3


          When you run python3 via env, the latter performs the search through PATH, so it allows your shebang not to rely on specific location of python3 binary.



          Finally, the correct version of your script would be as follows:



          #!/usr/bin/env python3
          # services/users/manage.py

          from flask.cli import FlaskGroup

          from project import app

          cli = FlaskGroup(app)

          if __name__ == '__main__':
          cli()





          share|improve this answer

























          • Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

            – Robert van der Starre
            Mar 25 at 14:58













          1












          1








          1







          When you execute a script, the kernel looks for the interpreter specified in the shebang (#!). The location of the interpreter is extracted, and then the interpreter (e.g. python3) is launched, executing the script itself. If the interpreter binary is not found, execution fails with a No such file or directory (ENOENT) error (as per man 2 execve):



          ERRORS
          <...>
          ENOENT The file filename or a script or ELF interpreter does not exist,
          or a shared library needed for the file or interpreter cannot be found.


          You have specified #!/usr/bin/python3 in your shebang, but in the base image you use (python:3.7.2-alpine) the python3 binary is at different location:



          $ docker run -it python:3.7.2-alpine sh
          / # which python3
          /usr/local/bin/python3


          So, even if your application works locally at your host (if it is Windows, it probably even does not care about the shebang), it stops working when you move it into the Docker container.



          To avoid such situations, shebangs in scripts usually refer not to the interpreter itself (#!/usr/bin/python3), but to /usr/bin/env binary, which finds and executes the interpreter:



          #!/usr/bin/env python3


          When you run python3 via env, the latter performs the search through PATH, so it allows your shebang not to rely on specific location of python3 binary.



          Finally, the correct version of your script would be as follows:



          #!/usr/bin/env python3
          # services/users/manage.py

          from flask.cli import FlaskGroup

          from project import app

          cli = FlaskGroup(app)

          if __name__ == '__main__':
          cli()





          share|improve this answer















          When you execute a script, the kernel looks for the interpreter specified in the shebang (#!). The location of the interpreter is extracted, and then the interpreter (e.g. python3) is launched, executing the script itself. If the interpreter binary is not found, execution fails with a No such file or directory (ENOENT) error (as per man 2 execve):



          ERRORS
          <...>
          ENOENT The file filename or a script or ELF interpreter does not exist,
          or a shared library needed for the file or interpreter cannot be found.


          You have specified #!/usr/bin/python3 in your shebang, but in the base image you use (python:3.7.2-alpine) the python3 binary is at different location:



          $ docker run -it python:3.7.2-alpine sh
          / # which python3
          /usr/local/bin/python3


          So, even if your application works locally at your host (if it is Windows, it probably even does not care about the shebang), it stops working when you move it into the Docker container.



          To avoid such situations, shebangs in scripts usually refer not to the interpreter itself (#!/usr/bin/python3), but to /usr/bin/env binary, which finds and executes the interpreter:



          #!/usr/bin/env python3


          When you run python3 via env, the latter performs the search through PATH, so it allows your shebang not to rely on specific location of python3 binary.



          Finally, the correct version of your script would be as follows:



          #!/usr/bin/env python3
          # services/users/manage.py

          from flask.cli import FlaskGroup

          from project import app

          cli = FlaskGroup(app)

          if __name__ == '__main__':
          cli()






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 13:07

























          answered Mar 25 at 12:49









          Danila KiverDanila Kiver

          7451 gold badge7 silver badges17 bronze badges




          7451 gold badge7 silver badges17 bronze badges












          • Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

            – Robert van der Starre
            Mar 25 at 14:58

















          • Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

            – Robert van der Starre
            Mar 25 at 14:58
















          Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

          – Robert van der Starre
          Mar 25 at 14:58





          Thank you for the answer! It works now. I also had to change the linefeed of the file from CRLF to LF.

          – Robert van der Starre
          Mar 25 at 14:58













          1














          add werkzeug==0.14.1 to requirement.txt can fix same bug appear on windows.
          its seems like a werkzeug bug.






          share|improve this answer























          • This fixed mine, thanks.

            – bjk116
            Jun 19 at 1:53















          1














          add werkzeug==0.14.1 to requirement.txt can fix same bug appear on windows.
          its seems like a werkzeug bug.






          share|improve this answer























          • This fixed mine, thanks.

            – bjk116
            Jun 19 at 1:53













          1












          1








          1







          add werkzeug==0.14.1 to requirement.txt can fix same bug appear on windows.
          its seems like a werkzeug bug.






          share|improve this answer













          add werkzeug==0.14.1 to requirement.txt can fix same bug appear on windows.
          its seems like a werkzeug bug.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 8 at 8:22









          yich chiayich chia

          112 bronze badges




          112 bronze badges












          • This fixed mine, thanks.

            – bjk116
            Jun 19 at 1:53

















          • This fixed mine, thanks.

            – bjk116
            Jun 19 at 1:53
















          This fixed mine, thanks.

          – bjk116
          Jun 19 at 1:53





          This fixed mine, thanks.

          – bjk116
          Jun 19 at 1:53

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336316%2fflask-cli-throws-errno-2-no-such-file-when-deploying-with-docker%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해