Nesta etapa, você aprenderá como inspecionar uma imagem Docker para visualizar informações detalhadas sobre ela. O comando docker inspect fornece uma grande quantidade de informações sobre objetos Docker, incluindo imagens, contêineres, redes e volumes. Por padrão, ele gera a informação em um formato estruturado.
Para inspecionar uma imagem, você usa o comando docker inspect seguido pelo nome ou ID da imagem. Vamos inspecionar a imagem hello-world que você puxou na etapa anterior.
docker inspect hello-world
Este comando gerará uma grande quantidade de informações sobre a imagem hello-world em um formato padrão. A saída inclui detalhes como o ID da imagem, data de criação, arquitetura, sistema operacional e configuração.
[
{
"Id": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"RepoTags": ["hello-world:latest"],
"RepoDigests": [
"hello-world@sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591"
],
"Parent": "",
"Comment": "",
"Created": "2023-03-07T21:50:09.004511104Z",
"Container": "a928b81f51a91111111111111111111111111111111111111111111111111111",
"ContainerConfig": {
"Hostname": "a928b81f51a9",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": ["/hello"],
"Image": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "20.10.21",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": ["/hello"],
"Image": "sha256:f5233545e4356188889db81cd1e163ee0d68e4b9b2863974888a98019dbf8591",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1330,
"VirtualSize": 1330,
"GraphDriver": {
"Data": null,
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2db29710123e5455b34e722505b562504b39e55355e344405b54d3153a94650b"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
Esta saída padrão fornece uma visão abrangente da configuração e metadados da imagem. Nas próximas etapas, você aprenderá como formatar esta saída para extrair informações específicas.