First create a specific project directory for your docker image. For example: mkdir /home/pi/Desktop/teasr/capturing Copy the dockerfile and script there and change the current context to this directory cp /home/pi/Desktop/teasr/capturing.py /home/pi/Desktop/teasr/dockerfile /home/pi/Desktop/teasr/capturing/ cd /home/pi/Desktop/teasr/capturing This is best practice because the first thing docker-engine does when building is to read the entire current context. Next we'll take a look at your Dockerfile. It should now look like this: The next thing you need to do is to build it with a smart name, the use of dots is generally discouraged. docker build -t pulkit/capturing:1.0 . Next is to run the image like you did. docker run -ti --name capturing pulkit/capturing:1.0 The script is now executed inside the container and may exit when finished. Note: The first line in the script needs to be #! /usr/bin/env python . This is the end of this article about how to run Python scripts on Docker. For more information about how to run Python scripts on Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Implementing a simple calculator with javascript
>>: Advanced and summary of commonly used sql statements in MySQL database
background As the company's sub-projects incr...
In the past, creating a printer-friendly version ...
Result:Implementation code: html <!-- Please h...
Table of contents 1. What is an index? 2. Why do ...
1. What is HTML HTML (HyperText Markup Language):...
View system help help contents mysql> help con...
A WeakMap object is a collection of key/value pai...
This article shares the specific code of JavaScri...
brew install nginx Apple Mac uses brew to install...
Table of contents Preface: Detailed introduction:...
The default ssh remote port in Linux is 22. Somet...
I think editors are divided into two categories, ...
1. Overview The information_schema database is th...
CSS style: Copy code The code is as follows: <s...
1. The emergence of the problem Wrote a flat list...