Skip to content

hhunterzinck/docker-python-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

docker-python-script

This repository runs a single python script with specific package requirements via Docker. The python script accepts command line arguments that can be entered via the Docker run command.

Instructions

Clone the github repo and navigate to the directory. Type in the following commands:

docker build -t docker-python-script .
docker run --rm docker-python-script --message 'hello world!'

The Dockerfile uses the standard Python image in the Docker repository, builds the Docker container according to the requirements, executes the script, and then stops and removes the Docker container.

If the environment is installed correctly, the result should output 'Old pandas version'. The script exploits an antiquated functionality of older pandas package version that automatically sorted column names alphabetically after appending to another data frame. The script checks that the data frame columns have been sorted alphabetically to ensure that an older version of pandas has been correctly installed.

The script will also output the entered message by the user (i.e. 'hello world!'). The message can be changed to show how different parameters may be input to the script for the same Docker container. For example:

docker run --rm docker-python-script --message 'The quick brown fox jumps over the lazy dog'

About

Run a single python script with requirements via docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published