Hacker News new | ask | show | jobs
by LukeLambert 2006 days ago
I'm not great at bash, but this little script worked for me.

    #!/usr/bin/env bash
    docker ps --format "{{.ID}} {{.Names}}" | while read line; do
      read -ra arr <<<"$line"
      id="${arr[0]}"
      names="${arr[1]}"
      arch="$(docker exec "$id" uname -m)"
      echo -e "$arch\t$names"
    done
Or this one-liner with worse formatting:

    docker ps --format "{{.Names}}" | xargs -tI {} docker exec {} uname -m