Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Useful Docker commands

Useful Docker commands

Search for Drupal or Drupal-like installs in all started containers (assumes overlay2 storage used):

sudo docker inspect $(docker ps --format '{{.ID}}') --format '{{.GraphDriver.Data.MergedDir}} {{.Name}}' | xargs -L1 bash -c 'echo Scanning container "$1"; sudo find $0 -name authorize.php'

docker-ps Like docker ps -a but with less info:

sudo docker ps -a --format "table {{.ID}}\t{{.Status}}\t{{.Names}}\t{{.Image}}"

docker-ips Command to get a nice list of containers and their IPs (add | cowthink -ny | lolcat for extra points):

docker network inspect cts | python3 -c 'import json, sys; cts = sorted(json.loads([0]["Containers"].items(), key=lambda c: int(c[1]["IPv4Address"].split("/")[0].split(".")[-1])); print("\n".join(n[:6]+" "+c["IPv4Address"]+" "+c["Name"] for n, c in cts))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.