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

        "Mounts": [
{
"Type": "bind",
"Source": "/data1/cmsphp",
"Destination": "/data1",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/data1/ftp/public/src/cms",
"Destination": "/data1/ms",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
]

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

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

完整信息:

[root@localhost log]# docker inspect cmsphp
[
{
"Id": "8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd",
"Created": "2020-02-22T15:19:27.031944204Z",
"Path": "/run.sh",
"Args": [
"php-fpm",
"--nodaemonize"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": ,
"ExitCode": ,
"Error": "",
"StartedAt": "2020-02-22T15:19:27.827341786Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:24f1fd58634ae496cdbb889c6d42397e6914255c7f86180cbc7207892f8e5ac3",
"ResolvConfPath": "/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/hostname",
"HostsPath": "/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/hosts",
"LogPath": "/var/lib/docker/containers/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd/8de99c8b2a9d6e6ef65302f39153a161a21df0f477bb12bdd0343441b6e35bcd-json.log",
"Name": "/cmsphp",
"RestartCount": ,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/data1/cmsphp/:/data1/",
"/data1/ftp/public/src/cms/:/data1/ms/"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"9000/tcp": [
{
"HostIp": "",
"HostPort": ""
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount":
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": [
"locfront.sina.com.cn:10.23.3.227",
"ds.uscms.pub.sina.com.cn:10.23.3.226"
],
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": ,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": ,
"Runtime": "runc",
"ConsoleSize": [
, ],
"Isolation": "",
"CpuShares": ,
"Memory": ,
"NanoCpus": ,
"CgroupParent": "",
"BlkioWeight": ,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": ,
"CpuQuota": ,
"CpuRealtimePeriod": ,
"CpuRealtimeRuntime": ,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": ,
"KernelMemoryTCP": ,
"MemoryReservation": ,
"MemorySwap": ,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": ,
"CpuPercent": ,
"IOMaximumIOps": ,
"IOMaximumBandwidth": ,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/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/diff",
"MergedDir": "/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/merged",
"UpperDir": "/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/diff",
"WorkDir": "/var/lib/docker/overlay2/49307940dcdb643286a0b4080dab70993e24aa499df60a920221630fbb5d634e/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/data1/cmsphp",
"Destination": "/data1",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/data1/ftp/public/src/cms",
"Destination": "/data1/ms",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "8de99c8b2a9d",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"9000/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PHPIZE_DEPS=autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2c",
"PHP_INI_DIR=/usr/local/etc/php",
"PHP_EXTRA_CONFIGURE_ARGS=--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi",
"PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie",
"GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312",
"PHP_VERSION=7.4.1",
"PHP_URL=https://www.php.net/get/php-7.4.1.tar.xz/from/this/mirror",
"PHP_ASC_URL=https://www.php.net/get/php-7.4.1.tar.xz.asc/from/this/mirror",
"PHP_SHA256=561bb866bdd509094be00f4ece7c3543ec971c4d878645ee81437e291cffc762",
"PHP_MD5="
],
"Cmd": [
"php-fpm",
"--nodaemonize"
],
"Image": "sinamess/php",
"Volumes": null,
"WorkingDir": "/var/www/html",
"Entrypoint": [
"/run.sh"
],
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGQUIT"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "fd003aa0da95f80dd2ca451b8328c5ffd07f25c554963eb4db60cd4fed5da6fb",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": ,
"Ports": {
"9000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": ""
}
]
},
"SandboxKey": "/var/run/docker/netns/fd003aa0da95",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "deee664fb763a1c5e22a028814bb74f8d35f99ac178d667c5c1401cd5c37fd14",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": ,
"IPAddress": "172.17.0.7",
"IPPrefixLen": ,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:07",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "8cff241007ebcdedde49d32b0dfa0dad5c0a6316c87e53e40ae3029403d8282a",
"EndpointID": "deee664fb763a1c5e22a028814bb74f8d35f99ac178d667c5c1401cd5c37fd14",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.7",
"IPPrefixLen": ,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": ,
"MacAddress": "02:42:ac:11:00:07",
"DriverOpts": null
}
}
}
}
]

[Docker] 使用docker inspect查看宿主机与容器的共享目录的更多相关文章

  1. Docker拷贝宿主机与容器中的文件

    如果我们需要将宿主机文件拷贝到容器内可以使用 docker cp 命令,也可以将文件从容器内拷贝到宿主机 将宿主机文件拷贝到容器内 docker cp 要拷贝的宿主机文件或目录 容器名称:容器文件或目 ...

  2. docker环境 宿主机和容器之间复制文件

    容器往宿主机:docker cp 3234234324234:/database_dump_bak/db_bak.dmp /home/test 宿主机往容器:docker cp wenjian_001 ...

  3. docker swarm集群挂载宿主机目录

    创建DOCKER集群,挂载宿主机目录src:宿主机目录,dst:容器目录 docker service create --name testrd --detach=false --mount type ...

  4. linux-Redhat7 windows物理机与虚拟机设置共享目录

    一                   windows物理机与虚拟机设置共享目录 1.1        WMware Workstation点击重新安装WMware Tools 此时会弹出在客户机装载 ...

  5. docker 宿主机与容器直接文件移动命令

    1.将容器中的文件复制到宿主机 我们把容器中的 nginx 目录整个复制到  宿主机/usr/local/nginx 目录下,使用如下命令: docker cp nginx_test: /etc/ng ...

  6. docker容器 - 宿主机和容器之间复制文件(cp)

    实验环境 CentOS 7.5 容器 容器是镜像的运行实例.不同的是,镜像是静态的只读文件,而容器带有运行时需要的可写文件层:同时,容器中的应用进程处于运行状态. 主机和容器之间复制文件 要想实现在主 ...

  7. Docker-使用数据卷在宿主机和容器间的数据共享

    场景一:现在用Docker创建了N个容器,但是这些容器之间需要数据共享,这个时候我们应该怎么办?[参考第四步] 场景二:docker创建了一个容器并进入容器,添加了一些定制功能,此时除了用docker ...

  8. 开发时从宿主机连接容器中的MySQL

    从宿主机连接Docker容器中的MySQL 刚接触Docker,电脑安装Docker后,使用docker命令pull了一个MySQL5.6的Docker镜像,之后docker run启动创建容器. 可 ...

  9. docker容器与宿主机的数据交互

    在生产环境中使用 Docker ,往往需要对数据进行持久化,或者需要在多个容器之间进行数据共享,这必然涉及容器的数据管理操作. 方式一.Docker cp命令 docker cp :用于容器与主机之间 ...

随机推荐

  1. testng使用详解

    一.testng 介绍 TestNG 是一个测试框架,其灵感来自 JUnit 和 NUnit,但同时引入了一些新的功能,使其功能更强大,使用更方便. TestNG 设计涵盖所有类型的测试:单元,功能, ...

  2. AI初探

    看东西应该记笔记,不然如过眼云烟,如只逛商场,不买东西,不留下带走什么,就是浪费时间,没有收获,仅此开始,定期梳理看过的东西. 人工智能的目的是什么呢? 答:让机器表现得更像人类,甚至在某些技能上超越 ...

  3. 【置顶】入驻百家号【九哥聊IT】和【九哥九嫂小日子】,欢迎关注

    欢迎大家关注. 1.关注百家号[九哥聊IT],每天专注讲解互联网最新资讯和知识分享.2.关注百家号[九哥九嫂小日子],带你看下班之外的九哥.

  4. 云原生 - Istio可观察性之分布式跟踪(三)

    作者:justmine 头条号:大数据与云原生 微信公众号:大数据与云原生 创作不易,在满足创作共用版权协议的基础上可以转载,但请以超链接形式注明出处. 为了方便阅读,微信公众号已按分类排版,后续的文 ...

  5. Linux基础:简介安装、常用命令和JDK、Mysql、Tomcat的安装

    一.Linux的简介 1.Linux的概述 Linux是基于Unix的开源免费的操作系统,由于系统的稳定性和安全性几乎成为程序代码运行的最佳系统环境.Linux是由Linus Torvalds(林纳斯 ...

  6. linux之samba使用

    工作中,很多时候,我导出文件,或者上传文件的时候经常失败,报samba fail,但我并不知道samba是干什么用的,也老是听同事说什么samba没有挂载,但我基本上不知道什么是samba,更不要说什 ...

  7. Leetcode 题目整理-7 Remove Element & Implement strStr()

    27. Remove Element Given an array and a value, remove all instances of that value in place and retur ...

  8. 深入JVM类加载器机制,值得你收藏

    先来一道题,试试水平 public static void main(String[] args) { ClassLoader c1 = ClassloaderStudy.class.getClass ...

  9. 深入源码解析spring aop实现的三个过程

    Spring AOP的面向切面编程,是面向对象编程的一种补充,用于处理系统中分布的各个模块的横切关注点,比如说事务管理.日志.缓存等.它是使用动态代理实现的,在内存中临时为方法生成一个AOP对象,这个 ...

  10. 并发队列之PriorityBlockingQueue

    这一篇说一下PriorityBlockingQueue,引用书中的一句话:这就是带优先级的无界阻塞队列,每次出队都返回优先级最高或者最低的元素(这里规则可以自己制定),内部是使用平衡二叉树实现的,遍历 ...