Each string must be its own item in the array. Note that “-c print(‘Hi there!’)” wouldn’t work. The -c argument tells Python that the code you want executed follows. The image puts Python in the search path, so you can call it without worrying about where it’s located. You’re running Python with a one-line program. The first is the executable, and the rest are the arguments it will pass to Python. The second line contains the command that Docker will run by default when this image is loaded. In this case, we’re using the lightweight Alpine Linux distribution with the latest version of Python installed and ready to go. Over at Docker Hub, you can find images with almost any Linux distribution and with almost any software package ready to use. Your Dockerfile will always start with a FROM line. The first line tells Docker which image to start building with. A Dockerfile contains a list of directives describing how to build your image.Ĭreate a text file named Dockerfile with these contents.ĬMD Start with an empty directory and create your first Dockerfile. That’s your first lesson! You can use Docker to run software that isn’t installed on the host system. You’ll be running Python inside your Docker containers, but you don’t need Python installed on your development system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |