2. Definitions For Command¶
Commands can contain following definitions:
| Name | Type | Default | Required |
|---|---|---|---|
| build | array | No | |
| command | string | up | No |
| description | string | null | No |
| enable | boolean | true | No |
| file | string | docker-compose.yml | No |
| help | string | null | No |
| name | string | current directory name | No |
| parent | string | null | No |
| rm | array | No | |
| scale | array | No | |
| up | array | No | |
| verbose | boolean | false | No |
Example with default values:
extensions:
PhpZone\Docker\DockerCompose:
command_name:
build:
no_cache: false
command: up
description: ~
enable: true
file: ~
help: ~
name: ~ # current directory name
parent: ~
rm:
force: false
scale: ~
up:
daemon: false
no_recreate: false
no_build: false
verbose: false
Note
The order of the definitions is not important.
Note
Not required definitions don’t need to be set.
2.1. build¶
| Type | Default | Required |
|---|---|---|
| array | No |
Extended options in case of the definition command: build.
Example with default values:
extensions:
PhpZone\Docker\DockerCompose:
command_name:
build:
no_cache: false
2.2. command¶
| Type | Default | Required |
|---|---|---|
| string | up | No |
Specifies which command will be run against services. Available commands are: build, kill, logs, ps,
pull, rm, scale, start, stop and up. For more information read official documentation of
Docker Compose.
2.3. description¶
| Type | Default | Required |
|---|---|---|
| string | null | No |
The description of a command will be displayed when a developer would run the command list or without any command.
2.4. enable¶
| Type | Default | Required |
|---|---|---|
| boolean | true | No |
All defined commands are enabled by default. Sometimes can be useful to disable a command without its removal.
2.5. file¶
| Type | Default | Required |
|---|---|---|
| string | docker-compose.yml | No |
Specifies an alternate Compose yaml file. Official documentation of Docker Compose
2.6. help¶
| Type | Default | Required |
|---|---|---|
| string | null | No |
The help of a command will be displayed when a developer would run the command help.
2.7. name¶
| Type | Default Required | |
|---|---|---|
| string | current directory name | No |
Specifies an alternate project name. Official documentation of Docker Compose
2.8. parent¶
| Type | Default | Required |
|---|---|---|
| string | null | No |
It can help you to define more commands related to the same definitions, so it can help to avoid duplications.
The value is defined as parent: command_name.
Example:
extensions:
PhpZone\Docker\DockerCompose:
command_name_1:
command: up
name: myproject
command_name_2:
command: stop
parent: command_name_1
If you run:
$ vendor/bin/phpzone comand_name_2
This will compose docker-compose -p myproject stop and execute it.
2.9. rm¶
| Type | Default | Required |
|---|---|---|
| array | No |
Extended options in case of the definition command: rm.
Example with default values:
extensions:
PhpZone\Docker\DockerCompose:
command_name:
rm:
force: false
2.10. scale¶
| Type | Default | Required |
|---|---|---|
| array | No |
Extended options in case of the definition command: scale. Numbers are specified in the form
service_name: integer.
Example:
extensions:
PhpZone\Docker\DockerCompose:
command_name:
scale:
service_name_1: 3
service_name_2: 2
2.11. up¶
| Type | Default | Required |
|---|---|---|
| array | No |
Extended options in case of the definition command: up.
Example with default values:
extensions:
PhpZone\Docker\DockerCompose:
command_name:
up:
daemon: false
no_recreate: false
no_build: false
2.11.1. daemon¶
| Type | Default | Required |
|---|---|---|
| boolean | false | No |
Detached mode: Run containers in the background, print new container names.
2.11.2. no_recreate¶
| Type | Default | Required |
|---|---|---|
| boolean | false | No |
If containers already exist, don’t recreate them.
2.11.3. no_build¶
| Type | Default | Required |
|---|---|---|
| boolean | false | No |
Don’t build an image, even if it’s missing.
2.12. verbose¶
| Type | Default | Required |
|---|---|---|
| boolean | false | No |
Show more output. Official documentation of Docker Compose