Created
September 16, 2018 19:35
-
-
Save circa10a/87151fc62aa4a48a2c08f9ab1253c3d7 to your computer and use it in GitHub Desktop.
get running docker container info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import docker | |
client = docker.from_env() | |
kwargs = { | |
"image":'alpine:3.8', | |
"name": 'test', | |
"command": 'tail -f /dev/null', | |
"detach": True, | |
"ports": { | |
'2222/tcp': 3333 | |
} | |
} | |
test = client.containers.run(**kwargs) | |
print(docker.APIClient(base_url='unix://var/run/docker.sock').containers()) | |
test.remove(force=True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment