Skip to content

Instantly share code, notes, and snippets.

@Clivern
Created November 2, 2021 19:43
Show Gist options
  • Save Clivern/a7b03a4d90da991c49aa976b79e345ca to your computer and use it in GitHub Desktop.
Save Clivern/a7b03a4d90da991c49aa976b79e345ca to your computer and use it in GitHub Desktop.
Run a Python Script with Docker Container
FROM python:3.9.7
MAINTAINER Clivern
RUN mkdir -p /etc/muffin
VOLUME /etc/muffin
CMD ["python"]
@Clivern
Copy link
Author

Clivern commented Nov 2, 2021

$ docker build -t python:3.9.7 .
$ echo 'print("Hello World")' > /etc/muffin/ff7a0ad4-0625-4a45-8c24-dbbd59c5fa6a.py
$ docker run --rm -v /etc/muffin:/etc/muffin python:3.9.7 python /etc/muffin/ff7a0ad4-0625-4a45-8c24-dbbd59c5fa6a.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment