Skip to content

Instantly share code, notes, and snippets.

@circa10a
Created September 16, 2018 19:35
Show Gist options
  • Save circa10a/87151fc62aa4a48a2c08f9ab1253c3d7 to your computer and use it in GitHub Desktop.
Save circa10a/87151fc62aa4a48a2c08f9ab1253c3d7 to your computer and use it in GitHub Desktop.
get running docker container info
#!/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