【Docker】Docker学习⑨ - 单机编排之Docker Compose

一、Docker简介

二、Docker安装及基础命令介绍

三、Docker镜像管理

四、Docker镜像与制作

五、Docker数据管理

六、网络部分

七、Docker仓库之单机Dokcer Registry

八、Docker仓库之分布式Harbor

九、单机编排之Docker Compose

当在宿主机启动较多的容器的时候,如果都是手动操作会觉得比较麻烦而且容易出错,这个时候推荐使用docker单机编排工具docker compose,Dokcer Compose是docker容器的一种编排服务,docker compose是一个管理多个容器的工具,比如可以解决容器之间的依赖关系,就像启动一个web就必须得先把数据库服务先启动一样,docker compose完全可以替代docker run启动容器。

  • github地址:https://github.com/docker/compose

1 基础环境准备

  • 1.1 安装python环境及pip命令
	yum install https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm -y
	yum install python-pip -y
	pip install --upgrade pip 
  • 1.2 安装docker compose
	pip install docker-compose
  • 1.3 验证版本
	docker-compose version

日志:

	[root@gbase8c_private ~]# docker-compose version
	/usr/lib/python2.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
	from cryptography.hazmat.backends import default_backend
	docker-compose version 1.26.2, build unknown
	docker-py version: 4.4.4
	CPython version: 2.7.5
	OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017
  • 1.4 查看帮助
	docker-compose --help
	[root@gbase8c_private ~]# docker-compose --help
	/usr/lib/python2.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
	from cryptography.hazmat.backends import default_backend
	Define and run multi-container applications with Docker.
	
	Usage:
	docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
	docker-compose -h|--help
	
	Options:
	-f, --file FILE             Specify an alternate compose file
								(default: docker-compose.yml)
	-p, --project-name NAME     Specify an alternate project name
								(default: directory name)
	-c, --context NAME          Specify a context name
	--verbose                   Show more output
	--log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
	--no-ansi                   Do not print ANSI control characters
	-v, --version               Print version and exit
	-H, --host HOST             Daemon socket to connect to
	
	--tls                       Use TLS; implied by --tlsverify
	--tlscacert CA_PATH         Trust certs signed only by this CA
	--tlscert CLIENT_CERT_PATH  Path to TLS certificate file
	--tlskey TLS_KEY_PATH       Path to TLS key file
	--tlsverify                 Use TLS and verify the remote
	--skip-hostname-check       Don't check the daemon's hostname against the
								name specified in the client certificate
	--project-directory PATH    Specify an alternate working directory
								(default: the path of the Compose file)
	--compatibility             If set, Compose will attempt to convert keys
								in v3 files to their non-Swarm equivalent
	--env-file PATH             Specify an alternate environment file
	
	Commands:
	build              Build or rebuild services
	config             Validate and view the Compose 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值