Skip to content

Instantly share code, notes, and snippets.

@pasknel
Last active June 20, 2019 02:41
Show Gist options
  • Save pasknel/bd4cad406b19cc65506c3f028c93887e to your computer and use it in GitHub Desktop.
Save pasknel/bd4cad406b19cc65506c3f028c93887e to your computer and use it in GitHub Desktop.
Search for docker.sock in all containers
import docker
client = docker.from_env()
for container in client.containers.list():
try:
container_id = container.short_id
container_name = container.name
bits, stat = container.get_archive('/var/run/docker.sock')
print "[+] Docker.sock found in container: {0} ({1})".format(container_id, container_name)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment