How to run my python script on docker?

前端 未结 6 401
小蘑菇
小蘑菇 2020-12-14 07:10

I am trying to run my python script on docker. I tried different ways to do it but not able to run it on docker. My python script is given below:

import os

         


        
6条回答
  •  旧巷少年郎
    2020-12-14 08:15

    I Followed @samprog (most accepted) answer on my machine running on UBUNTU VERSION="14.04.6". and was getting "standard_init_linux.go:195: exec user process caused "exec format error"

    None of the solution worked for me mentioned above.

    Fixed the error after changing my Dockerfile as follows

    FROM python:latest

    COPY capturing.py ./capturing.py

    CMD ["python","/capturing.py"]

    Note: If your script import some other module then you need to modify COPY statement in your Dockerfile as follows - COPY *.py ./

    Hope this will be useful for others.

提交回复
热议问题