docker-compose 命令帮助文档


使用 docker-compose --help 命令可以查看帮助文档。

本机版本:docker-compose version 1.29.2, build 5becea4c--help 打印结果如下:

Define and run multi-container applications with Docker.

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

  -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

  build              Build or rebuild services
  config             Validate and view the Compose file
  create             Create services
  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
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show version information and quit
.NET Core 新建 Docker 支持项目但是无法启动的问题

新建一个 .NET Core API 项目并且使用 Docker,但是启动 docker-compose 项目时总是报错。

========== 正在准备容器 ==========
正在准备 Docker 容器...
docker-compose  -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.override.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose5563428382167899646 --no-ansi config
The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
      context: D:\work\Middleware\2_SourceCode\dev\net\octopus
      dockerfile: octopus/Dockerfile
      target: base
    entrypoint: tail -f /dev/null
      NUGET_FALLBACK_PACKAGES: /root/.nuget/fallbackpackages
    image: octopus:dev
    labels: ' --additionalProbingPath /root/.nuget/packages
        --additionalProbingPath /root/.nuget/fallbackpackages  bin/Debug/netcoreapp2.1/octopus.dll' /bin/bash -c "if PID=$$(pidof
        -x dotnet); then kill $$PID; fi" dotnet /app
    - target: 80
    - /d/work/Middleware/2_SourceCode/dev/net/octopus/octopus:/app:rw
    - /c/Users/liujiajia/vsdbg/vs2017u5:/remote_debugger:ro
    - /c/Program Files/dotnet/sdk/NuGetFallbackFolder:/root/.nuget/fallbackpackages:ro
    - /c/Users/liujiajia/.nuget/packages:/root/.nuget/packages:ro
version: '3.4'
docker ps --filter "status=running" --filter "name=dockercompose5563428382167899646_octopus_" --format {{.ID}} -n 1
docker-compose  -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.override.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose5563428382167899646 --no-ansi build 
The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
Building octopus
Step 1/3 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
 ---> 84e946977e6f
Step 2/3 : WORKDIR /app
 ---> Using cache
 ---> ec0ac0017bcb
Step 3/3 : EXPOSE 80
 ---> Running in 0af5744be080
Removing intermediate container 0af5744be080
 ---> 865a37e2ba37
Successfully built 865a37e2ba37
Successfully tagged octopus:dev
docker-compose  -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\docker-compose.override.yml" -f "D:\work\Middleware\2_SourceCode\dev\net\octopus\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose5563428382167899646 --no-ansi up -d --no-build --force-recreate --remove-orphans
The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
Creating network "dockercompose5563428382167899646_default" with the default driver
Creating dockercompose5563428382167899646_octopus_1 ... 
Creating dockercompose5563428382167899646_octopus_1 ... done
完成!Docker 容器已准备就绪。
========== 调试 ==========
docker ps --filter "status=running" --filter "name=dockercompose5563428382167899646_octopus_" --format {{.ID}} -n 1
docker inspect --format="{{json .NetworkSettings.Ports}}" ba7bee30e308