Basic Python Flask app in Docker which prints the hostname and IP of the container
Build the Docker image manually by cloning the Git repo.
$ git clone https://github.com/b1t3x/python-flask-docker.git
$ docker build -t b1t3x/python-flask-docker .
You can also just download the existing image from DockerHub.
docker pull b1t3x/orel-flask
Create a container from the image.
$ docker run --name my-container -d -p 8080:8080 b1t3x/orel-flask
Now visit http://localhost:8080
The hostname of the container is 6095273a4e9b and its IP is 172.17.0.2.
Verify by checking the container ip and hostname (ID):
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container
172.17.0.2
$ docker inspect -f '{{ .Config.Hostname }}' my-container
6095273a4e9b
I have implemented CI with the following services:
- GitHub Actions - Creates a container image and pushes it to Docker Hub.
- Travis-CI - Runs a test to see the Flask app responds with a 200 HTTP code.
**NOTE: Code Quality was implemented as well, using Code Climate Quality