[Docker] 使用docker inspect查看宿主机与容器的共享目录

docker inspect 容器名,可以查看到容器的元信息,在返回的j'son信息里面有个Mounts字段可以看到挂载目录

        "Mounts": [
            {
                Type": bind,Source/data1/cmsPHPDestination/data1Mode""RW": truePropagationrprivate
            },{
                /data1/ftp/public/src/cms/data1/ms
            }
        ]
@H_403_51@

可以看到宿主机是/data1/cmsPHP   挂载到容器 /data1

宿主机/data1/ftp/public/src/cms  挂载到容器 /data1/ms

完整信息:

[root@localhost log]# docker inspect cmsPHP
[
    {
        Id8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcdCreated2020-02-22T15:19:27.031944204ZPath/run.shArgs: [
            PHP-fpm--nodaemonize
        ],1)">State: {
            StatusrunningRunningPausedfalseRestartingOOMKilledDeadPid10656ExitCode0ErrorStartedAt2020-02-22T15:19:27.827341786ZFinishedAt0001-01-01T00:00:00Z
        },1)">Imagesha256:24f1fd58634ae496cdbb889c6d42397e6914255c7f86180cbc7207892f8e5ac3ResolvConfPath/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/resolv.confHostnamePath/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/hostnameHostsPath/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/hostsLogPath/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd-json.logName/cmsPHPRestartCountDriveroverlay2PlatformlinuxMountLabelProcessLabelAppArmorProfileExecIDsnullHostConfigBinds: [
                /data1/cmsPHP/:/data1//data1/ftp/public/src/cms/:/data1/ms/
            ],1)">ContainerIDFileLogConfig: {
                json-fileConfig: {}
            },1)">NetworkModedefaultPortBindings9000/tcp: [
                    {
                        HostIpHostPort9001
                    }
                ]
            },1)">RestartPolicynoMaximumRetryCountAutoRemoveVolumeDriverVolumesFromCapAddCapDropCapabilitiesDns: [],1)">DnsOptionsDnsSearchExtraHostslocfront.sina.com.cn:10.23.3.227ds.uscms.pub.sina.com.cn:10.23.3.226GroupAddIpcModeprivateCgroupLinksOomscoreAdjPidModePrivilegedPublishAllPortsReadonlyRootfsSecurityOptUTSModeUsernsModeShmSize67108864RuntimeruncConsoleSizeIsolationcpuSharesMemoryNanocpusCgroupParentBlkioWeightBlkioWeightDeviceBlkioDeviceReadBpsBlkioDeviceWriteBpsBlkioDeviceReadiopsBlkioDeviceWriteIOpscpuPeriodcpuQuotacpuRealtimePeriodcpuRealtimeRuntimecpusetcpuscpusetMemsDevicesDeviceCgroupRulesDeviceRequestsKernelMemoryKernelMemoryTCPMemoryReservationMemorySwapMemorySwappinessOomKillDisablePidsLimitUlimitscpuCountcpuPercentIOMaximumIOpsIOMaximumBandwidthMaskedPaths/proc/asound/proc/acpi/proc/kcore/proc/keys/proc/latency_stats/proc/timer_list/proc/timer_stats/proc/sched_debug/proc/scsi/sys/firmwareReadonlyPaths/proc/bus/proc/fs/proc/irq/proc/sys/proc/sysrq-trigger
            ]
        },1)">GraphDriverDataLowerDir/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e-init/diff:/var/lib/docker/overlay2/d5b75bc6a7da35cabed94b9823fa1eb41802533b540d8a568b083bea5cac666d/diff:/var/lib/docker/overlay2/0cf2d3d2f30ebdb7a6ea54c5bc46d7f66f8e84fe4aaea7b8af7e6c56086e549d/diff:/var/lib/docker/overlay2/996361ec9516b992b6562560985bc4ffa3d7ffcde94d277ecbbaf6a61a9b0a54/diff:/var/lib/docker/overlay2/35fb38c04eabeebf21de3717bb5b2a2e13d6df3555916b046fd1d90ff7c16abb/diff:/var/lib/docker/overlay2/16c97b27b72b2bcd33ddbad49cef97801366a237f78b34c728007ebd821ec8ef/diff:/var/lib/docker/overlay2/c4d05fcafb5a08f5a6b14d6ca93711bc034e8bebeb637101c339a3b821e71e31/diff:/var/lib/docker/overlay2/786099514d19740e956c8432ab5ca8ee61141d7c77c758cc00348e1df722e94f/diff:/var/lib/docker/overlay2/3c59d443fdb1d910bd815d8be06ff41bc78171f74c67c15b57c2532baab71ff4/diff:/var/lib/docker/overlay2/2bd3d05194285297b54a0f77af6c08a8c8306502193d96bfe0321da0ccf96347/diff:/var/lib/docker/overlay2/747be5f7344f4c51b0196ff6be4ead6fea4dc05d2e707576b8cb808a19cfe693/diff:/var/lib/docker/overlay2/7f0ae842527d6aae43c41b0661fa3894764966748e50962f6ead696d8e074cc1/diff:/var/lib/docker/overlay2/04782b00fbe8b31279f1ea9c5021cd596a7ab7586e69c0771f16c829b1251567/diff:/var/lib/docker/overlay2/98bc05305659159b6b419ff12737d1f034599c38a19652df0603a2a8c574fe05/diff:/var/lib/docker/overlay2/f6ffb61f08ebf053154f774018c3684b88c6426873362823e2848a9a615facc2/diffMergedDir/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/mergedUpperDir/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/diffWorkDir/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/work
            }
        ],1)">Hostname8de99c8b2a9dDomainnameUserAttachStdinAttachStdoutAttachStderrExposedPortsTtyOpenStdinStdinOnceEnvPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binPHPIZE_DEPS=autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2cPHP_INI_DIR=/usr/local/etc/PHPPHP_EXTRA_CONFIGURE_ARGS=--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgiPHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pieGPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312PHP_VERSION=7.4.1PHP_URL=https://www.PHP.net/get/PHP-7.4.1.tar.xz/from/this/mirrorPHP_ASC_URL=https://www.PHP.net/get/PHP-7.4.1.tar.xz.asc/from/this/mirrorPHP_SHA256=561bb866bdd509094be00f4ece7c3543ec971c4d878645ee81437e291cffc762PHP_MD5=Cmdsinamess/PHPVolumesWorkingDir/var/www/htmlEntrypointOnBuildLabels: {},1)">StopSignalSIGQUITNetworkSettingsBridgeSandBoxIDfd003aa0da95f80dd2ca451b8328c5ffd07f25c554963eb4db60cd4fed5da6fbHairpinModeLinkLocalIPv6AddressLinkLocalIPv6PrefixLenPorts0.0.0.0SandBoxKey/var/run/docker/netns/fd003aa0da95SecondaryIPAddressesSecondaryIPv6AddressesEndpointIDdeee664fb763a1c5e22a028814bb74f8d35f99ac178d667c5c1401cd5c37fd14Gateway172.17.0.1GlobalIPv6AddressGlobalIPv6PrefixLenIPAddress172.17.0.7IPPrefixLen16IPv6GatewayMacAddress02:42:ac:11:00:07Networksbridge: {
                    IPAMConfigAliasesNetworkID8cff241007ebcdedde49d32b0dfa0dad5c0a6316c87e53e40ae3029403d8282aDriverOpts
                }
            }
        }
    }
]
@H_403_51@

 

相关文章

Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Li...
1、什么是docker?答:docker是开源的应用容器引擎;开发人员把他们的应用及依赖包打包发布到容器当中。...
1、什么是namespace? 答:名称空间,作用隔离容器 2、namespace隔离有那些? 答:ipc:共享内存、消息队...
1、Docker能在非Linux平台(Windows+MacOS)上运行吗? 答:可以 2 、如何将一台宿主机的docker环境...
环境要求: IP hostname 192.168.1.1 node1 项目规划: 容器网段:172.16.10.0/24 NGINX:172.16.10.10...
文档上传地址:https://files.cnblogs.com/files/lin-strive/07-docker%E8%B7%A8%E4%B8%BB%E6%9C%BA%E7...