Pages

Tuesday, March 25, 2014

Python in a container on Fedora, using Docker

In just a few simple steps, you can have an instance of Python up and running in a Docker container. This one was contributed by Aditya Patawari. You can get the latest Dockerfiles here:

https://github.com/scollier/Fedora-Dockerfiles

Tested on Docker 0.7.6 and 0.8.1 and Fedora 20

Get the version of Docker:

# docker version


To build:


Copy the sources down and do the build-

# docker build -rm -t /python .

To run (if port 8080 is open on your host):

# docker run -d -p 8080:8080 /python

or to assign a random port that maps to port 80 on the container:

# docker run -d -p 8080 /python

To the port that the container is listening on:

# docker ps

To test:

# curl http://localhost:8080


No comments:

Post a Comment