G.S
G.S

Reputation: 10871

docker compose command to run with profiles

With the recent update of docker, whenever I run docker-compose up -d docker engine suggest me with the following line:

Docker Compose is now in the Docker CLI, try docker compose up

Question is how can I run docker compose command with profile option?
For example, in docker-compose I can use profiles as docker-compose --profile dev up.
Is there a similar thing in docker compose too?

I looked into the CLI reference but didn't find anything.

Upvotes: 7

Views: 7130

Answers (1)

Eranga Heshan
Eranga Heshan

Reputation: 5804

docker compose has profile option. Try executing docker compose --help in your terminal and you will see the below help section with the option of profile

╰>>> docker compose --help

Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the Compose file)
  -p, --project-name string        Project name

Commands:
  build       Build or rebuild services
  convert     Converts the compose file to platform's canonical format
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  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 containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     unpause services
  up          Create and start containers

Run 'docker compose COMMAND --help' for more information on a command.

If your docker CLI doesn't have this option maybe you will have to upgrade your docker CLI.

Here is the Docker CLI documentation with --profile option.

Upvotes: 5

Related Questions