DCA · Question #31
The output of which command can be used to find the architecture and operating system an image is compatible with?
The correct answer is C. docker image inspect --format {{.Architecture}} {{.OS}} ' <image-id>. To identify an image's architecture and operating system, the docker image inspect command should be used with the --format flag.
Question
The output of which command can be used to find the architecture and operating system an image is compatible with?
Options
- Adocker image inspect --filter {{.Architecture}} {{.OS}} ' <image-id>
- Bdocker image ls <image-id>
- Cdocker image inspect --format {{.Architecture}} {{.OS}} ' <image-id>
- Ddocker image info <image-id>
How the community answered
(32 responses)- B3% (1)
- C94% (30)
- D3% (1)
Why each option
To identify an image's architecture and operating system, the `docker image inspect` command should be used with the `--format` flag.
The `--filter` flag is used to filter lists of resources, not to format the output of a single resource inspection, and its syntax here is incorrect for output formatting.
The `docker image ls` command is used to list Docker images but does not provide detailed information like architecture or operating system for a specific image.
The `docker image inspect` command provides detailed low-level information about a Docker image. By using the `--format` flag with Go template syntax like `{{.Architecture}}` and `{{.OS}}`, specific metadata fields, such as the image's architecture and operating system, can be extracted directly from the inspection output.
The `docker image info` command provides information about the Docker daemon and its environment, not about a specific Docker image.
Concept tested: Docker image inspection and metadata formatting
Source: https://docs.docker.com/engine/reference/commandline/image_inspect/
Topics
Community Discussion
No community discussion yet for this question.