# Some Docker commands

This will take all running containers, and show you the ports and container names.

```bash
docker ps --format "{{.Names}} {{.Ports}}" | awk '{name=$1; for(i=2;i<=NF;i++) if($i~/0\.0\.0\.0:/) {split($i,a,":"); split(a[2],b,"->"); print b[1], name}}' | sort -n
```

## Inside containers:

The quickest way — run a curl command through the container and ask it what its public IP is:

- You can use this to see if it is using a VPN or not

```bash
docker exec container-name curl -s https://ipinfo.io
```