1:docker的默认存放位置:

  $ sudo su

  # cd /var/lib/docker
  # ls -F
  containers/ graph/ repositories volumes/
 
 2:把docker容器中的信息挂载到宿主机上指定的目录:
  我在项目中用到需要时,将logback的日志在容器中挂载到宿主机上,

docker run -p 9005:9000 -it -v /home/docker/forecast/user/log:/var/log/forecast forecast/forecast.user.login /bin/bash

<configuration>

  <property name="APP_NAME" value="forecast.user.login" />
<property name="LOG_PATH" value="/var/log/forecast" />
<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" /> <appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOG_PATH}/${APP_NAME}.log</file>
<encoder>
<pattern>%date [%level] from %logger in %thread - %message%n%xException</pattern>
</encoder>
 
 
$docker ps | less -S
[root@dpydalapp02 Downloads]# docker inspect dc617832a4df
[
{
"Id": "dc617832a4df88144f4d9c9dedd8e6237159983824817245c79725c034885635" ,
"Created": "2018-04-03T15:10:16.537716619Z",
"Path": "/bin/sh",
"Args": [
"-c",
"java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForH eap -cp '/maven/*' -Dhttp.address=\"0.0.0.0\" -Dhttp.port=\"9000\" play.core.s erver.ProdServerStart"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": ,
"ExitCode": ,
"Error": "",
"StartedAt": "2018-04-03T15:10:16.742726688Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:738162b63cad82721ca96666d28bfa461d2fa36ea2f03fb5ae8bb89 4df781ce5",
"ResolvConfPath": "/var/lib/docker/containers/dc617832a4df88144f4d9c9ded d8e6237159983824817245c79725c034885635/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/dc617832a4df88144f4d9c9dedd8 e6237159983824817245c79725c034885635/hostname",
"HostsPath": "/var/lib/docker/containers/dc617832a4df88144f4d9c9dedd8e62 37159983824817245c79725c034885635/hosts",
"LogPath": "/var/lib/docker/containers/dc617832a4df88144f4d9c9dedd8e6237 159983824817245c79725c034885635/dc617832a4df88144f4d9c9dedd8e6237159983824817245 c79725c034885635-json.log",
"Name": "/practical_mayer",
"RestartCount": ,
"Driver": "overlay",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": [
"65db615b68e77d7e4771fdbed5075b14e3e5c15446e59a472610f0365457f349",
"e6bf642713ecb75e187f1b70bd0ff55956d904394e137e3e77482b2f2ed1e74f",
"284bf463c8627e19d9277334448d570cd25443fdc6b9f7299924b1f2f11af141",
"35e56760d67edf3e3e1748a067e30211c44235ca4a2154504bb24fad12ce0a04"
],
"HostConfig": {
"Binds": null,
"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,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"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": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": ,
"CpuQuota": ,
"CpuRealtimePeriod": ,
"CpuRealtimeRuntime": ,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DiskQuota": ,
"KernelMemory": ,
"MemoryReservation": ,
"MemorySwap": ,
"MemorySwappiness": -,
"OomKillDisable": false,
"PidsLimit": ,
"Ulimits": null,
"CpuCount": ,
"CpuPercent": ,
"IOMaximumIOps": ,
"IOMaximumBandwidth":
},
"GraphDriver": {
"Name": "overlay",
"Data": {
"LowerDir": "/var/lib/docker/overlay/965099abd4a056db5ffd538d867 0472afa233cc053ec56116025ee103dc5b0dd/root",
"MergedDir": "/var/lib/docker/overlay/7f3b3d68d1a9d143460b42ae1a 8d1600e929e459b89b3bfaa9b9c4ae21d0d769/merged",
"UpperDir": "/var/lib/docker/overlay/7f3b3d68d1a9d143460b42ae1a8 d1600e929e459b89b3bfaa9b9c4ae21d0d769/upper",
"WorkDir": "/var/lib/docker/overlay/7f3b3d68d1a9d143460b42ae1a8d 1600e929e459b89b3bfaa9b9c4ae21d0d769/work"
}
},
"Mounts": [],
"Config": {
"Hostname": "dc617832a4df",
"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:/b in:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
"LANG=C.UTF-8",
"JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/jre",
"JAVA_VERSION=8u151",
"JAVA_ALPINE_VERSION=8.151.12-r0"
],
"Cmd": null,
"ArgsEscaped": true,
"Image": "forecast/forecast.user.login",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/bin/sh",
"-c",
"java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimit ForHeap -cp '/maven/*' -Dhttp.address=\"0.0.0.0\" -Dhttp.port=\"9000\" play.co re.server.ProdServerStart"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "22c620d718adfea09dac0eecf4257e7a1135ede6993a4ca413fd1e cdfa3bbef4",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": ,
"Ports": {
"9000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": ""
}
]
},
"SandboxKey": "/var/run/docker/netns/22c620d718ad",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "f4cb19dc49d934cbe0fe63a1a4d1a3e6153d212d26cd8c0c583f8 d8aec97e2ab",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": ,
"IPAddress": "172.17.0.4",
"IPPrefixLen": ,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "ed31251886bbeda09a512bbddcd2481372b183bd610abf 3a38326264165a4056",
"EndpointID": "f4cb19dc49d934cbe0fe63a1a4d1a3e6153d212d26cd8 c0c583f8d8aec97e2ab",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": ,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": ,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]
 
 

docker 学习(七) docker 容器挂载的更多相关文章

  1. Docker学习之Docker容器基本使用

    Docker学习之Docker容器基本使用 新建容器并启动 命令格式:docker run --options repository:tag 后台运行 命令格式:-d 已存在的容器相关操作 启动:do ...

  2. Docker学习笔记 — Docker私有仓库搭建

    Docker学习笔记 — Docker私有仓库搭建   目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2   和Mavan的管理一样,Dockers ...

  3. Docker学习之Docker镜像基本使用

    Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...

  4. Docker学习笔记 - Docker容器内部署redis

    Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...

  5. Docker学习笔记 - Docker容器之间的连接

    学习目标: 容器之间可以相互连接访问:: --link redis:redisAlias 准备工作 FROM ubuntu:14.04 RUN apt-get install -y ping RUN  ...

  6. Docker学习笔记 - Docker的数据卷容器

    一.什么是数据卷容器 如果你有一些持续更新的数据需要在容器之间共享,最好创建数据卷容器. 数据卷容器:用于容器间的数据共享,主动挂载宿主机目录,用于其他容器挂载和共享. 二.数据卷容器的操作 1.创建 ...

  7. Docker学习第二天-容器

    Docker 容器 容器是 Docker 又一核心概念. 简单的说,容器是独立运行的一个或一组应用,以及它们的运行态环境.对应的,虚拟机可以理解为模拟运行的一整套操作系统(提供了运行态环境和其他系统环 ...

  8. DOCKER学习_002:Docker的容器管理

    一 Docker的基本信息 前面已经安装了Docker,现在看一下已安装Docker的安装环境以及其他信息 1.1 系统环境 [root@docker-server3 ~]# uname -r -.e ...

  9. docker学习:docker容器数据卷

    是什么 docker的理念 将运用与运行的环境打包形成容器运行,运行可以伴随着容器,但是我们对数据的要求希望是持久化的 容器之间希望有可能共享数据 docker容器产生的数据,如果不通过docker ...

  10. Docker学习之3——容器

    容器(Container) 容器介绍: docker是通过容器来运行业务的,就像运行一个kvm虚拟机是一样的.容器其实就是从镜像创建的一个实例. 我们可以对容器进行增删改查,容器之间也是相互隔离的.和 ...

随机推荐

  1. python从安装与使用pip到入门

    官方下载地址:https://www.python.org/downloads/ 下载后直接安装就可以了 再配一下环境变量, cmd运行python -V (注意,这里是大写的V) 打开python跑 ...

  2. python 基础 9.0 安装MySQL-python-1.2.5客户端

    一. 安装客户端     python 标准数据库接口为Python DB-API,Python DB-API 为开发人员提供了数据应用编程接口.参考地址:https://wiki.python.or ...

  3. PageHelper

    https://pagehelper.github.io/ Mybatis分页插件PageHelper简单使用 SpringBoot之分页PageHelper

  4. python _、__和__xx__的区别(转)

    本位转载自:http://www.cnblogs.com/coder2012/p/4423356.html "_"单下划线 Python中不存在真正的私有方法.为了实现类似于c++ ...

  5. [转]C#中的结构体与类的区别

    C#中的结构体与类的区别   经常听到有朋友在讨论C#中的结构与类有什么区别.正好这几日闲来无事,自己总结一下,希望大家指点. 1. 首先是语法定义上的区别啦,这个就不用多说了.定义类使用关键字cla ...

  6. 怎么利用jquery.form 提交form

    说明:开发环境 vs2012 asp.net mvc c# 利用jQuery.form.js提交form 1.HTML前端代码 <%@ Page Language="C#" ...

  7. js实现随机选取[10,100)中的10个整数,存入一个数组,并排序。 另考虑(10,100]和[10,100]两种情况。

    1.js实现随机选取[10,100)中的10个整数,存入一个数组,并排序. <!DOCTYPE html> <html lang="en"> <hea ...

  8. oracle 11g ocr 冗余配置

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/royjj/article/details/30506343  oracle 11g ocr 冗余 ...

  9. (Android)react-native-splash-screen实践-解决react-native打包好后启动白屏的问题

    1.安装 npm i react-native-splash-screen --save or yarn add react-native-splash-screen --save 2.自动配置 re ...

  10. Qt — tableWidget插入复选框

    之前不太了解Qt中的相关控件,一直尝试直接在tableview上增加复选框. 但相对来说,在tableview增加复选框的工作量与麻烦程度远超tableWidget. 接下来是如何在Qt的tableW ...