standard_init_linux.go:207:exec用户进程导致“ exec格式错误”。 [英] standard_init_linux.go:207: exec user process caused "exec format error"
问题描述
我当前正在尝试将Docker应用程序部署到容器注册表Azure中。我能够在本地运行我的docker映像,但是当我将其部署到azure时,它给了我这个错误:
I am currently trying to deploy my docker application to the container registry Azure. I am able to run my docker image locally but when I deploy it to azure, it gives me this error:
standard_init_linux.go:207:exec用户进程引起了 exec格式错误
这是我的dockerfile:
standard_init_linux.go:207: exec user process caused "exec format error" Here is my dockerfile:
*Pull a pre-built alpine docker image with nginx and python3 installed
*this image is from docker community, its small so our upload to contain will be faster
FROM tiangolo/uwsgi-nginx-flask:python3.7
FROM ubuntu:latest
ENV LISTEN_PORT=8400
EXPOSE 8400
RUN apt-get update && apt-get install -y /
curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5\
&& rm -rf /var/lib/apt/lists/*
*adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/19.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql17
*install SQL Server drivers
RUN apt-get update && ACCEPT_EULA=Y apt-get -f install -y unixodbc-dev
*install SQL Server tools
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
RUN apt-get update && apt-get install -y python3-pip
RUN apt-get update && apt-get install -y libpq-dev
*install additional requirements from a requirements.txt file
COPY requirements.txt /
RUN pip3 install --no-cache-dir -r /requirements.txt
COPY app/. /.
CMD python3 wsgi.py
因为我不了解azure如何调用我的Docker映像后,我继续尝试不同的CMD版本,例如:
Because I do not understand how azure calls my Docker images, I kept on trying different CMD versions such as:
CMD [ python3, wsgi.py, runserver, 0.0.0.0:8400]
CMD ["python3", "wsgi.py", "runserver", "0.0.0.0:8400"]
但无济于事。我在互联网上查找解决方案,但实际上找不到任何解决方案。那里有人对我的错有深刻的见解吗?创建.sh文件是否必要?我是Linux新手,所以任何见解都将对您有所帮助!
But to no avail. I looked up on internet for solutions but really could not find any. Is there anyone there that has insights on what I do wrong? Is it essential to create a .sh file ? I am new to linux so any insights will help!
再次感谢!
推荐答案
我实际上找到了问题的答案。对于Windows用户,我们实际上需要将she-bang放在我们的系统上,也许是在创建.sh文件,还是将she-bang放在我们的python入口处,例如:
I actually found out the answer to my question. for windows user, we actually need to put the she-bang on our system, may it be creating an .sh file, or putting the she-bang on our python entry place, example:
将shebang设置为您的py文件:
set shebang to your py file:
#!/usr/bin/env python
或设置与Dockerfile中相同的命令。在这里找到答案:
standard_init_linux .go:211:exec用户进程引起 exec格式错误
or setup the command the same as you did in Dockerfile. Found the answer here: standard_init_linux.go:211: exec user process caused "exec format error"
希望这对将来有所帮助!
Hope this helps in the future!
这篇关于standard_init_linux.go:207:exec用户进程导致“ exec格式错误”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!