Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lvthillo/python-flask-docker
Basic Python Flask app in Docker which prints the hostname and IP of the container
https://github.com/lvthillo/python-flask-docker
docker python-flask
Last synced: 3 days ago
JSON representation
Basic Python Flask app in Docker which prints the hostname and IP of the container
- Host: GitHub
- URL: https://github.com/lvthillo/python-flask-docker
- Owner: lvthillo
- License: apache-2.0
- Created: 2018-07-19T21:36:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-03T10:59:44.000Z (over 1 year ago)
- Last Synced: 2024-12-23T19:10:53.210Z (10 days ago)
- Topics: docker, python-flask
- Language: Python
- Size: 8.79 KB
- Stars: 76
- Watchers: 5
- Forks: 337
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-flask-docker
Basic Python Flask app in Docker which prints the hostname and IP of the container### Build application
Build the Docker image manually by cloning the Git repo.
```
$ git clone https://github.com/lvthillo/python-flask-docker.git
$ docker build -t lvthillo/python-flask-docker .
```### Download precreated image
You can also just download the existing image from [DockerHub](https://hub.docker.com/r/lvthillo/python-flask-docker/).
```
docker pull lvthillo/python-flask-docker
```### Run the container
Create a container from the image.
```
$ docker run --name my-container -d -p 8080:8080 lvthillo/python-flask-docker
```Now visit http://localhost:8080
```
The hostname of the container is 6095273a4e9b and its IP is 172.17.0.2.
```### Verify the running container
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
```