I've created a simple Flask Application and running it in the Docker Container. I want to access that container's ID in my Flask App (python script). Is there any way to get the Container's ID?
I've created a simple Flask Application and running it in the Docker Container. I want to access that container's ID in my Flask App (python script). Is there any way to get the Container's ID?
The hostname in the docker container is a short hash of its id. In turn you can use this to get the hostname in Python/Flask:
import socket
docker_short_id = socket.gethostname()