![]() # Here we put the file at the image root folder. # The second parameter '/' is the path where to put the file on the image. # The first parameter 'main.py' is the name of the file on the host. # In order to launch our python code, we must import it into our image. # So we write 'python' for the image name and 'latest' for the version. # In our example, we want import the python image. Perfect, we’ll use it! # A dockerfile must always start by importing the base image. The first result is the official image created to execute Python. In our case, we will type ‘Python’ in the search bar. This site contains many pre-designed images to save your time (for example: all images for linux or code languages). The first step to take when you create a Docker file is to access the DockerHub website. A linux (Ubuntu) with Python installed on it should be enough. To do this, our Docker must contain all the dependencies necessary to launch Python. Some theory: the first thing to do when you want to create your Dockerfile is to ask yourself what you want to do. Nothing exceptional, but once you see “ Docker is magic!” displayed in your terminal you will know that your Docker is working. You can add the following code to the ‘ main.py’ file: #!/usr/bin/env python3 Normally you should have this folder architecture. A ‘ Dockerfile’ file (Docker file that will contain the necessary instructions to create the environment). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |