Home > Net >  Run python script using a docker image
Run python script using a docker image

Time:04-24

I downloaded a python script and a docker image containing commands to install all the dependencies. How can I run the python script using the docker image?

CodePudding user response:

Copy python file in Docker image then execute -

docker run image-name script.py

Or you can also build the DockerFile by using the RUN python script.py inside DockerFile.

CodePudding user response:

Run in interactive mode:

 docker run -it image_name python filename.py

or if you want host and port to be specified:

 docker run -it -v filename.py:filename.py -p 8888:8888 image_name python filename.py 
  • Related