Docker Compose文件详解 V2
container_name: my-web-container
- docker-compose up,启动web服务之前、启动redis、db。
- docker-compose up web,启动web容器时,检查依赖depends_on的配置内容,先启动db和redis
- redis
db:
image: postgres
- 8.8.8.8
- 9.9.9.9
dns_search
Custom DNS search domains. Can be a single value or a list.
- dc1.example.com
- dc2.example.com
tmpfs:
- /run
- /tmp
entrypoint: /code/entrypoint.sh
entrypoint:
- php
- -d
- zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
- -d
- memory_limit=-1
- vendor/bin/phpunit
env_file: .env
env_file:
- ./common.env
- ./apps/web.env
- SHOW=true
- SESSION_SECRET
expose:
- "3000"
- "8000"
--add-host
parameter.extra_hosts:
- "somehost:162.242.195.82"
/etc/hosts
:
162.242.195.82
somehost
50.31.209.229 otherhost
image: redis
image: ubuntu:14.04image: tutum/influxdb
image: example-registry.com:4000/postgresql
image: a4bc65fd
labels:
com.example.description: "Accounting webapp"
com.example.department: "Finance"
com.example.label-with-empty-value: ""
labels:
- "com.example.description=Accounting webapp"
- "com.example.department=Finance"
- "com.example.label-with-empty-value"
syslog-address: "tcp://192.168.0.42:123"
net
net: "bridge"
net: "host"
net: "none"
net: "container:[service name or container name/id]"
network_mode
network_mode: "bridge"
network_mode: "host"
network_mode: "none"
network_mode: "service:[service name]"
network_mode: "container:[container name/id]"
networks
Version 2 file format only. In version 1, use net.
networks
key.pid: "host"
ports:
- "3000"
- "3000-3005"
- "8000:8000"
- "9090-9091:8080-8081"
- "49100:22"
- "127.0.0.1:8001:8001"
- "127.0.0.1:5000-5010:5000-5010"
volumes:
# Just specify a path and let the Engine create a volume
- /var/lib/mysql
# Specify an absolute path mapping
- /opt/data:/var/lib/mysql
# Path on the host, relative to the Compose file
- ./cache:/tmp/cache
# User-relative path
- ~/configs:/etc/configs/:ro
# Named volume
# datavolume是通过docker volume create --name datavolume创建
volume_driver
.例如rancher的convoy fs。volume_driver: mydriver
ro
)或读写 (rw
). 如果不设置,默认为读写模式。Note: The Container:...
formats are only supported in the version 2 file format. In version 1, you can use container names without marking them as such:
- service_name
- service_name:ro
- container_name
- container_name:rw
cpu_shares, cpu_quota, cpuset, domainname, hostname, ipc,
mac_address, mem_limit, memswap_limit, privileged, read_only, restart,
shm_size, stdin_open, tty, user, working_dir
driver: foobar
You can also specify the name of the volume separately from the name used to refer to it within the Compose file:
Docker Compose文件详解 V2的更多相关文章
- 附005.Docker Compose文件详解
一 Docker Compose文件简介 compose文件使用yml格式,主要分为了四个区域: version:用于指定当前docker-compose.yml语法遵循哪个版本 services:服 ...
- 附003.Docker Compose命令详解
一 Docker Compose命令格式 Usage: docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...] docker- ...
- Docker Compose配置文件详解(V3)
Docker Compose配置文件是Docker Compose的核心,用于定义服务.网络和数据卷.格式为YAML,默认路径为./docker-compose.yml,可以使用.yml或.yaml扩 ...
- Docker Compose 配置文件详解
先来看一份 docker-compose.yml 文件,不用管这是干嘛的,只是有个格式方便后文解说: version: '2' services: web: image: dockercloud/he ...
- docker entrypoint入口文件详解
docker entrypoint入口文件详解 pasting Dockerfile创建自定义Docker镜像以及CMD与ENTRYPOINT指令的比较 [k8s]args指令案例-彻底理解docke ...
- Docker学习(六)——Dockerfile文件详解
Docker学习(六)--Dockerfile文件详解 一.环境介绍 1.Dockerfile中所用的所有文件一定要和Dockerfile文件在同一级父目录下,可以为Dockerfile父目录的子目录 ...
- k8s之yaml文件详解
k8s之yaml文件详解 目录 k8s之yaml文件详解 1. k8s支持的文件格式 2. YAML语言格式 3. 查看api资源版本标签 4. 编写nginx-test.yaml资源配置清单 4.1 ...
- web.xml文件详解
web.xml文件详解 Table of Contents 1 listener. filter.servlet 加载顺序 2 web.xml文件详解 3 相应元素配置 1 listener. f ...
- Linux中/proc目录下文件详解
转载于:http://blog.chinaunix.net/uid-10449864-id-2956854.html Linux中/proc目录下文件详解(一)/proc文件系统下的多种文件提供的系统 ...
随机推荐
- 面向对象第二个特征-继承(Inheritance)
面向对象第二个特征-继承(Inheritance) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.java中的继承概述 1>.继承概述 多个类种存在相同属性和行为时,讲这 ...
- Airflow 使用 Celery 时,如何添加 Celery 配置
背景 前段时间我选用了 Airflow 对 wms 进行数据归档,在运行一段时间后,经常发现会报以下错误: [-- ::,: WARNING/ForkPoolWorker-] Failed opera ...
- 当spring单元测试需要用到临时表的时候
需要将整个单元测试的方法交给spring的事务管理器控制. 两种解决方法: 1.加载的spring配置文件中advice要切到需要测试的方法. 2.单元测试类继承AbstractTransaction ...
- MySQL表连接原理
以下文章均来自掘金小测: https://juejin.im/book/5bffcbc9f265da614b11b731/section/5c061b0cf265da612577e0f4 表连接本质: ...
- C# 基本元素
一.构成C#的基本元素 注释和空白编译器不会编译,自动忽略:而标记是可以通过编译器编译的. 关键字 (keyword) 官方定义:关键字是类似标识符的保留的字符序列,不能用作标识符(以 @ 字符开头时 ...
- 深入理解C指针<一>
指针和内存 C程序在编译后,会以三种形式使用内存: 静态.全局内存:静态变量和全局变量使用这部分内存,生存周期为整个程序运行时,全局变量所有函数都可以访问,但静态变量虽然生存周期为整个程序运行时,但作 ...
- 尝试用kotlin做一个app(写在前面)
学kotlin的目的好像就是做一个app,不一定有什么想做的项目,只是单纯想掌握这一门技术,确切地说只是单纯想学会做app.对于概念的东西,我也没兴趣深究,用得到的学一下,用不到的,就算了.我也不知道 ...
- Vue 项目de一些准备工作
1.安装node,同时也会自动安装npm,npm是node的一种包安装工具. 2.准备一个git,可以用来管理代码. 3.打开vue官网,可以使用vue-cli脚手架工作. 这里介绍一个element ...
- 面试题:你使用过concurrent包下的那些类?
1.executor接口,使用executor接口的子接口ExecutorService用来创建线程池2.Lock接口下的ReentrantLock类,实现同步,比如三个线程循环打印ABCABCABC ...
- UML-架构分析-步骤
1.识别->因素表 2.解决->技术备忘录 1).可靠性 2).法律问题 3).可适应性