Docker Cookbook


Getting Detailed Information About a Container with



Download 6,31 Mb.
Pdf ko'rish
bet214/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   210   211   212   213   214   215   216   217   ...   260
Bog'liq
Docker Cookbook

9.1 Getting Detailed Information About a Container with
docker inspect
Problem
You want to get detailed information about a container—such as when it was created,
what command was passed to the container, what port mappings exist, what IP
address the container has, and so forth.
Solution
Use the 
docker inspect
command. For example, start an Nginx container and use
inspect
:
$ docker run -d -p 80:80 nginx
$ docker inspect kickass_babbage
[{
"AppArmorProfile": "",
"Args": [
"-g",
274 | Chapter 9: Monitoring Containers


"daemon off;"
],
...
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
...
"NetworkSettings": {
...
"IPAddress": "172.17.0.3",
...
The 
inspect
command also works on an image:
$ docker inspect nginx
[{
"Architecture": "amd64",
"Author": "NGINX Docker Maintainers \"docker-maint@nginx.com\"",
"Comment": "",
"Config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
...
Discussion
The Docker 
inspect
command takes a 
format
option. You can use it to specify a
Golang template and extract specific information about a container or image instead
of getting the full JSON output:
$ docker inspect --help
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]
Return low-level information on a container or image
-f, --format="" Format the output using the given go template.
--help=false Print usage
For example, to get the IP address of a running container and check its state:
$ docker inspect -f '{{ .NetworkSettings.IPAddress }}' kickass_babbage
172.17.0.3
$ docker inspect -f '{{ .State.Running }}' kickass_babbage
true

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   210   211   212   213   214   215   216   217   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish