Difference between revisions of "Docker inspect"
Jump to navigation
Jump to search
(27 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{lc}} | ||
<code>[[docker]] inspect [[CONTAINER]]_ID|[[IMAGE_ID]]</code> (also available for: container, image, volume, network, node, service, or task) | <code>[[docker]] inspect [[CONTAINER]]_ID|[[IMAGE_ID]]</code> (also available for: container, image, volume, network, node, service, or task) | ||
* http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html | * http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html | ||
Line 4: | Line 5: | ||
− | + | docker inspect xxxxxx | grep Os | |
− | + | ||
+ | |||
+ | docker inspect xxxxxx | grep -i [[memory]] | ||
+ | "[[Memory]]": 37748736000, | ||
+ | "[[KernelMemory]]": 0, | ||
+ | "[[KernelMemoryTCP]]": 0, | ||
+ | "[[MemoryReservation]]": 0, | ||
+ | "[[MemorySwap]]": 75497472000, | ||
+ | "[[MemorySwappiness]]": null, | ||
+ | |||
+ | |||
+ | |||
+ | [[Docker Start configuration behavior and restart policy|Restart policy]]: <ref>https://stackoverflow.com/questions/43108227/is-it-possible-to-show-the-restart-policy-of-a-running-docker-container</ref> | ||
+ | |||
+ | * <code><nowiki>docker inspect --format '{{json .HostConfig.RestartPolicy}}' CONTAINER_NAME</nowiki></code> | ||
+ | |||
+ | [[Docker network|Network]] | ||
+ | * <code>docker inspect your-container | grep [[NetworkMode]]</code> | ||
== Volumes and mounts == | == Volumes and mounts == | ||
* List of mounts: <ref>https://stackoverflow.com/questions/30133664/how-do-you-list-volumes-in-docker-containers</ref> | * List of mounts: <ref>https://stackoverflow.com/questions/30133664/how-do-you-list-volumes-in-docker-containers</ref> | ||
− | < | + | <code><nowiki>docker inspect -f '{{ .Mounts }}' CONTAINER_NAME</nowiki></code> |
− | docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | jq . | + | <code><nowiki>docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | jq .</nowiki></code> |
− | docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | python -m json.tool</ | + | <code><nowiki>docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | python -m json.tool</nowiki></code> |
See also: <code>[[docker volume inspect]]</code> | See also: <code>[[docker volume inspect]]</code> | ||
== [[IP]] == | == [[IP]] == | ||
− | * <code>[[docker inspect]] CONTAINER_NAME | grep IPAddress</code> | + | * <code>[[docker inspect]] CONTAINER_NAME | grep [[IPAddress]]</code> |
+ | <pre> | ||
+ | docker inspect --format "{{ .NetworkSettings.IPAddress }}" | ||
+ | </pre> | ||
+ | |||
+ | == [[Start]] contiguration == | ||
+ | * <code>docker inspect -f "{{ .HostConfig.[[RestartPolicy]]}}" $([[docker ps -a]] -q)</code> | ||
== [[Docker inspect example]] == | == [[Docker inspect example]] == | ||
Line 23: | Line 47: | ||
docker inspect <container_id|container_name> | grep -A 5 LogConfig | docker inspect <container_id|container_name> | grep -A 5 LogConfig | ||
− | + | ||
− | "LogConfig": { | + | "[[LogConfig]]": { |
− | + | "Type": "syslog" | |
− | + | "Config": {} | |
− | } | + | } |
− | + | ||
+ | == OOM == | ||
+ | {{Docker inspect OOM}} | ||
+ | |||
+ | |||
+ | docker inspect [[your_container]] | grep [[mem]] | ||
== Related commands == | == Related commands == | ||
Line 34: | Line 63: | ||
* <code>[[docker container inspect]]</code> | * <code>[[docker container inspect]]</code> | ||
* <code>[[docker volume inspect]]</code> | * <code>[[docker volume inspect]]</code> | ||
+ | * [[docker buildx inspect]] | ||
== See also == | == See also == | ||
* {{docker inspect}} | * {{docker inspect}} | ||
− | * {{docker}} | + | * {{docker cmd}} |
− | |||
− | [[Category: | + | [[Category:Docker]] |
− | |||
− | |||
{{CC license}} | {{CC license}} | ||
Original Source: https://en.wikiversity.org/wiki/DevOps/Docker/docker_inspect | Original Source: https://en.wikiversity.org/wiki/DevOps/Docker/docker_inspect |
Latest revision as of 10:10, 12 May 2023
docker inspect CONTAINER_ID|IMAGE_ID
(also available for: container, image, volume, network, node, service, or task)
- http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html
- https://docs.docker.com/engine/reference/commandline/inspect/
docker inspect xxxxxx | grep Os
docker inspect xxxxxx | grep -i memory "Memory": 37748736000, "KernelMemory": 0, "KernelMemoryTCP": 0, "MemoryReservation": 0, "MemorySwap": 75497472000, "MemorySwappiness": null,
docker inspect --format '{{json .HostConfig.RestartPolicy}}' CONTAINER_NAME
docker inspect your-container | grep NetworkMode
Volumes and mounts[edit]
- List of mounts: [2]
docker inspect -f '{{ .Mounts }}' CONTAINER_NAME
docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | jq .
docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME | python -m json.tool
See also: docker volume inspect
IP[edit]
docker inspect CONTAINER_NAME | grep IPAddress
docker inspect --format "{{ .NetworkSettings.IPAddress }}"
Start contiguration[edit]
docker inspect -f "{{ .HostConfig.RestartPolicy}}" $(docker ps -a -q)
Docker inspect example[edit]
Redirecting container logs to syslog[edit]
docker inspect <container_id|container_name> | grep -A 5 LogConfig
"LogConfig": { "Type": "syslog" "Config": {} }
OOM[edit]
docker inspect grafana | grep -i OOM "OOMKilled": false, "OomScoreAdj": 0, "OomKillDisable": false,
docker inspect your_container | grep mem
Related commands[edit]
See also[edit]
docker inspect, docker container inspect, docker image inspect, docker volume inspect
docker
[config | pull
|push
|run
|start
, |stop
|cp
|events
|info
|version
|build
|commit
|image
|images
|image ls
|image inspect
|rmi
|rm
|tag
|exec | rename | manifest | save | service update | load
],docker --help
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Original Source: https://en.wikiversity.org/wiki/DevOps/Docker/docker_inspect
Advertising: