我运行
docker run -d -p 8080:80 -v /Users/caojinliang/Develop/docker nginx:latest
后,再运行
docker inspect nginx
显示如下,没有挂载上 volumn吗?我是mac环境
[
{
"Id": "sha256:c82521676580c4850bb8f0d72e47390a50d60c8ffe44d623ce57be521bca9869",
"RepoTags": [
"nginx:latest"
],
"RepoDigests": [
"nginx@sha256:d85914d547a6c92faa39ce7058bd7529baacab7e0cd4255442b04577c4d1f424"
],
"Parent": "",
"Comment": "",
"Created": "2018-07-24T17:21:51.548456912Z",
"Container": "895e85f09f69727097e9c1783362736d7ee9b5b32f9eae1e5e32f2e1002abf14",
"ContainerConfig": {
"Hostname": "895e85f09f69",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.15.2-1~stretch",
"NJS_VERSION=1.15.2.0.2.2-1~stretch"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"nginx\" \"-g\" \"daemon off;\"]"
],
"ArgsEscaped": true,
"Image": "sha256:f1eea4ec6bee804c269e8443513d7afe26adb1615518ad56d014973fd5faa5f3",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"DockerVersion": "17.06.2-ce",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.15.2-1~stretch",
"NJS_VERSION=1.15.2.0.2.2-1~stretch"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "sha256:f1eea4ec6bee804c269e8443513d7afe26adb1615518ad56d014973fd5faa5f3",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"Architecture": "amd64",
"Os": "linux",
"Size": 108975101,
"VirtualSize": 108975101,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/7005d0b35e6290baa63fa3b7b9b61a75f9e6e48c09d5590e21299c48aa405ace/diff:/var/lib/docker/overlay2/7f21a25318128c5f0303c2ad7cdc3069fb6b473606a6937755daee0173768e78/diff",
"MergedDir": "/var/lib/docker/overlay2/65e5cd78d834bfb1d84deac5f9b4d31f1c8646fdcc51acbb87df4807af9a7c7b/merged",
"UpperDir": "/var/lib/docker/overlay2/65e5cd78d834bfb1d84deac5f9b4d31f1c8646fdcc51acbb87df4807af9a7c7b/diff",
"WorkDir": "/var/lib/docker/overlay2/65e5cd78d834bfb1d84deac5f9b4d31f1c8646fdcc51acbb87df4807af9a7c7b/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:cdb3f9544e4c61d45da1ea44f7d92386639a052c620d1550376f22f5b46981af",
"sha256:a8c4aeeaa0451a16218376ce6ec0e55094128baeb0dbe122f1b25c3fa81a5a5b",
"sha256:08d25fa0442e3ea585b87bc6e9d41a1aa51624c83aec7fbafc1636f22eecf36f"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
docker inspect 后面跟你的容器id
你挂载的宿主机的目录存在吗?