54378

Docker run cannot find executable “uwsgi”

I am trying to deploy a falcon app with Docker. Here is my Dockerfile:

FROM python:2-onbuild # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app RUN pip install -r ./requirements.txt RUN pip install uwsgi EXPOSE 8000 CMD ["uwsgi", "--http”, " :8000" , "—wsgi-file”, "falconapp.wsgi"]

However I keep getting error saying:

/bin/sh: 1: [uwsgi,: not found

I've tried running uwsgi in the local directory and it works well with the command:

uwsgi --http :8000 --wsgi-file falconapp.wsgi

Why is Docker not working in this case???

Here is the log, I'm pretty sure uwsgi is installed:

Step 5/7 : RUN pip install uwsgi ---> Running in 2df7c8e018a9 Collecting uwsgi Downloading uwsgi-2.0.17.tar.gz (798kB) Building wheels for collected packages: uwsgi Running setup.py bdist_wheel for uwsgi: started Running setup.py bdist_wheel for uwsgi: finished with status 'done' Stored in directory: /root/.cache/pip/wheels/94/c9/63/e7aef2e745bb1231490847ee3785e3d0b5f274e1f1653f89c5 Successfully built uwsgi Installing collected packages: uwsgi Successfully installed uwsgi-2.0.17 Removing intermediate container 2df7c8e018a9 ---> cb71648306bd Step 6/7 : EXPOSE 8000 ---> Running in 40daaa0d5efa Removing intermediate container 40daaa0d5efa ---> 39c75687a157 Step 7/7 : CMD ["uwsgi", "--http”, " :8000" , "—wsgi-file”, "falconapp.wsgi"] ---> Running in 67e6eb29f3e0 Removing intermediate container 67e6eb29f3e0 ---> f33181adbcfa Successfully built f33181adbcfa Successfully tagged image_heatmap:latest dan@D-MacBook-Pro:~/Documents/falconapp_api$ docker run -p 8000:80 small_runner /bin/sh: 1: [uwsgi,: not found

Answer1:

very often you have to write the full patch for the executable. If you go to your container and run this command whereis uwsgi it will tell you it is at /usr/local/bin/uwsgi so your CMD should be in the same form:

CMD ["/usr/local/bin/uwsgi", "--http", " :8000" , "--wsgi-file", "falconapp.wsgi"]

Answer2:

I see some incorrect syntax in CMD, please use this:

CMD ["uwsgi", "--http", " :8000" , "--wsgi-file", "falconapp.wsgi"]

some double quotes are incorrect and -- is not before wsgi-file .

Recommend

  • Build and run C++ code on different version of Linux and glibc
  • How do I get C++ programs to link with gcc's stack protector feature on AIX?
  • Running PhantomJS from PHP with exec()
  • How to install modules for Apache 2.4 (OSX)?
  • tkplot in igraph within R
  • 'readline/readline.h' file not found
  • ruby - heroku: command not found
  • Getting IPv6 support with php5-geoip and Maxmind database
  • PyInstaller in Mac os X Mavericks
  • How To Make Composer (PSR-4) To Work With “.class.php” Extension?
  • hdfs namenode -format error (no such file or directory)
  • Docker run cannot find executable “uwsgi”
  • Installing R 3.3.2 in RHEL 6.8 without yum
  • dplyr do() without dot pronoun?
  • Gem not installing package
  • Unable to play media with vlc ocx
  • ADO and msqli connections very slow
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • PHP buffered output depending on server setting?
  • Jenkins: How To Build multiple projects from a TFS repository?
  • How do I fake an specific browser client when using Java's Net library?
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • ActionScript 2 vs ActionScript 3 performance
  • How to make Safari send if-modified-since header?
  • Large data - storage and query
  • How can I estimate amount of memory left with calling System.gc()?
  • Apache 2.4 - remove | delete | uninstall
  • WOWZA + RTMP + HTML5 Playback?
  • How to pass list parameters for each object using Spring MVC?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Linking SubReports Without LinkChild/LinkMaster
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll