Hacker News new | ask | show | jobs
by vocram 2009 days ago
Are users able to check if they are running a native arm64 container image, as opposed to an amd64 emulated one?

Or that’s something you have to infer from the execution speed?

2 comments

You can use manifest inspect[1] to see all supported architectures, and you should also be able to see on Docker Hub[2] as well.

EDIT: If you're asking specifically if you can tell what architecture a running container is using, a simple `docker inspect CONTAINER_ID` should show it.

[1] https://docs.docker.com/engine/reference/commandline/manifes... [2] https://hub.docker.com/_/node

I just checked myself, and you get notified with a nice WARNING upon a `docker run`:

    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
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