首页 > 其他分享 >docker-compose

docker-compose

时间:2023-02-12 20:35:51浏览次数:57  
标签:compose -- ## Compose file docker

安装Docker-Compose:

官方文档

  1. 安装
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

要安装不同版本的 Compose,请将 1.29.2 替换为您要使用的 Compose 版本

  1. 授权
## 对二进制文件应用可执行权限
chmod +x /usr/local/bin/docker-compose
## 查看是否安装完成
docker-compose --version
  1. 配置软链(可选)
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Docker-Compose命令

[root@localhost128 home]# docker-compose --help
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [--profile <name>...] [options] [--] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  ##  指定compose文件,默认为docker-compose.yml
  -f, --file FILE             Specify an alternate compose file (default: docker-compose.yml)
  ## 指定项目名称,默认为当前目录名称
  -p, --project-name NAME     Specify an alternate project name (default: directory name)
  --profile NAME              Specify a profile to enable
  -c, --context NAME          Specify a context name
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --ansi (never|always|auto)  Control when to print ANSI control characters
  --no-ansi                   Do not print ANSI control characters (DEPRECATED)
  -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 (DEPRECATED)
  --env-file PATH             Specify an alternate environment file

Commands:
  build              Build or rebuild services
  ## 验证并查看 Compose 文件
  config             Validate and view the Compose file
  create             Create services
  ## 停止并删除容器,可以指定单个服务 如:docker-compose down  <serviceName>
  down               Stop and remove resources
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  ## 启动服务,不指定名称就是启动所有, 指定就启动单个 如:docker-compose start  <serviceName>
  start              Start services
  ##停止服务,不指定名称就是停止所有, 指定就停止单个 如:docker-compose stop  <serviceName>
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  ## 创建并启动容器,可以指定单个服务 如:docker-compose up  <serviceName>
  up                 Create and start containers
  version            Show version information and quit

标签:compose,--,##,Compose,file,docker
From: https://www.cnblogs.com/xysgo/p/16867730.html

相关文章

  • docker-network
    DockerNetWork官网Docker容器和服务如此强大的原因之一是您可以将它们连接在一起,或者将它们连接到非Docker工作负载。Docker容器和服务甚至不需要知道它们部署在Do......
  • docker-run
    Dockerrun命令:--add-hostlistAddacustomhost-to-IPmapping添加一个host到ip的映射dockerrun-it--add-hosthostname1:192.168.1.2--add-hosthostname......
  • docker-volume
    dockervolume[root@localhost128home]#dockervolume--helpUsage:dockervolumeCOMMANDManagevolumesCommands:##创建一个容器卷createCreatea......
  • docker部署gitlab
    ---version:'3'services:gitlab:image:gitlab/gitlab-ce:latestrestart:alwaysports:-8443:443-8080:80-222:22container_......
  • docker 部署redis
    ---version:'3'services:redis:image:redis:7container_name:redisports:-6379:6379restart:alwaysvolumes:-./data:/......
  • Docker consul的容器服务更新与发现
    一、Consul概述(1)什么是服务注册与发现服务注册与发现是微服务架构中不可或缺的重要组件。起初服务都是单节点的,不保障高可用性,也不考虑服务的压力承载,服务之间调用单纯的......
  • Docker网络模式
    一、docker网络概述1、docker网络实现的原理Docker使用Linux桥接,在宿主机虚拟一个Docker容器网桥(docker0),Docker启动一个容器时会根据Docker网桥的网段分配给容器一个IP......
  • Docker的资源控制管理
    一、CPU控制cgroups,是一个非常强大的linux内核工具,他不仅可以限制被namespace隔离起来的资源,还可以为资源设置权重、计算使用量、操控进程启停等等。所以cgroups(Contr......
  • docker的安装及常用命令
    安装docker(ubuntu16.0)1.首先更新源-apt-getupdate2.安装docker-aptinstalldocker常用命令1.查看本地镜像仓库-dockerimagesrepository-镜像名称TAG-镜像描述(l......
  • docker完整安装步骤
    docker脚本安装:curl-fsSLhttps://get.docker.com-oget-docker.shshget-docker.sh配置镜像加速器:sudomkdir-p/etc/dockersudotee/etc/docker/daemon.json<......