summaryrefslogtreecommitdiff
path: root/contrib/man/md/docker-inspect.1.md
blob: a49e42138f2192ebc1bcb9975aef1967875f7aff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
% DOCKER(1) Docker User Manuals
% William Henry
% APRIL 2014
# NAME
docker-inspect - Return low-level information on a container/image

# SYNOPSIS
**docker inspect** [**-f**|**--format**="" CONTAINER|IMAGE
[CONTAINER|IMAGE...]

# DESCRIPTION

This displays all the information available in Docker for a given
container or image. By default, this will render all results in a JSON
array. If a format is specified, the given template will be executed for
each result.

# OPTIONS
**-f**, **--format**=""
   The text/template package of Go describes all the details of the
format. See examples section

# EXAMPLES

## Getting information on a container

To get information on a container use it's ID or instance name:

    #docker inspect 1eb5fabf5a03
    [{
       "ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
       "Created": "2014-04-04T21:33:52.02361335Z",
       "Path": "/usr/sbin/nginx",
       "Args": [],
       "Config": {
            "Hostname": "1eb5fabf5a03",
            "Domainname": "",
            "User": "",
            "Memory": 0,
            "MemorySwap": 0,
            "CpuShares": 0,
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "PortSpecs": null,
            "ExposedPorts": {
                "80/tcp": {}
        },
	    "Tty": true,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
               "HOME=/",
	       "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/usr/sbin/nginx"
            ],
            "Dns": null,
            "DnsSearch": null,
            "Image": "summit/nginx",
            "Volumes": null,
            "VolumesFrom": "",
            "WorkingDir": "",
            "Entrypoint": null,
            "NetworkDisabled": false,
            "OnBuild": null,
            "Context": {
               "mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650",
	       "process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650"
	    }
        },
        "State": {
            "Running": true,
            "Pid": 858,
            "ExitCode": 0,
            "StartedAt": "2014-04-04T21:33:54.16259207Z",
            "FinishedAt": "0001-01-01T00:00:00Z",
            "Ghost": false
        },
        "Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
        "NetworkSettings": {
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "Gateway": "172.17.42.1",
            "Bridge": "docker0",
            "PortMapping": null,
            "Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "80"
                    }
                ]
            }
        },
        "ResolvConfPath": "/etc/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
        "HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
        "Name": "/ecstatic_ptolemy",
        "Driver": "devicemapper",
        "ExecDriver": "native-0.1",
        "Volumes": {},
        "VolumesRW": {},
        "HostConfig": {
        "Binds": null,
            "ContainerIDFile": "",
            "LxcConf": [],
            "Privileged": false,
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "80"
                    }
                ]
            },
            "Links": null,
            "PublishAllPorts": false,
            "DriverOptions": {
                "lxc": null
            },
            "CliAddress": ""
        }

## Getting the IP address of a container instance

To get the IP address of a container use:

    # docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
    172.17.0.2

## Listing all port bindings

One can loop over arrays and maps in the results to produce simple text
output:

    # docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
     {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03

    80/tcp -> 80

## Getting information on an image

Use an image's ID or name (e.g. repository/name[:tag]) to get information
 on it.

    # docker inspect 58394af37342
    [{
        "id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9",
        "parent": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
        "created": "2014-02-03T16:10:40.500814677Z",
        "container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5",
        "container_config": {
            "Hostname": "88807319f25e",
            "Domainname": "",
            "User": "",
            "Memory": 0,
            "MemorySwap": 0,
            "CpuShares": 0,
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "PortSpecs": null,
            "ExposedPorts": null,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "HOME=/",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
		 "#(nop) ADD fedora-20-dummy.tar.xz in /"
            ],
            "Dns": null,
            "DnsSearch": null,
            "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
            "Volumes": null,
            "VolumesFrom": "",
            "WorkingDir": "",
            "Entrypoint": null,
            "NetworkDisabled": false,
            "OnBuild": null,
            "Context": null
        },
        "docker_version": "0.6.3",
        "author": "I P Babble \u003clsm5@ipbabble.com\u003e - ./buildcontainers.sh",
        "config": {
            "Hostname": "88807319f25e",
            "Domainname": "",
            "User": "",
            "Memory": 0,
            "MemorySwap": 0,
            "CpuShares": 0,
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "PortSpecs": null,
            "ExposedPorts": null,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "HOME=/",
		        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": null,
            "Dns": null,
            "DnsSearch": null,
            "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
            "Volumes": null,
            "VolumesFrom": "",
            "WorkingDir": "",
            "Entrypoint": null,
            "NetworkDisabled": false,
            "OnBuild": null,
            "Context": null
        },
	"architecture": "x86_64",
	"Size": 385520098
    }]

# HISTORY

April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.io source material and internal work.