This commit is contained in:
JMARyA 2023-12-17 19:09:53 +01:00
parent 6a528518a1
commit 8a44e4aeef
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 220 additions and 11 deletions

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,69 @@ repo: https://github.com/docker/compose
# Docker Compose
Compose is a tool for defining and running multi-container [Docker](Docker.md) applications. With Compose, you use a [YAML](../files/YAML.md) file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.
#todo -> add docker-compose cli usage
## Usage
Usage: `docker-compose [-f ComposeFile] [COMMAND] [OPTION]...`
### `docker-compose up`
Create and start containers.
#### Options
| Option | Description |
| -------------- | ----------------------------------------------- |
| `--build` | Build images before starting containers. |
| `-d, --detach` | Detached mode: Run containers in the background |
### `docker-compose down`
Stops containers and removes containers, networks, volumes, and images created by `up`.
### `docker-compose build`
Build or rebuild services
#### Options
| Option | Description |
| ------------ | ---------------------------------------------------- |
| `--no-cache` | Do not use cache when building the image |
| `--pull` | Always attempt to pull a newer version of the image. |
### `docker-compose cp`
Copy files/folders between a service container and the local filesystem
Usage: `docker compose cp [OPTIONS] SERVICE:SRC_PATH DEST_PATH|-`
### `docker-compose exec`
This is the equivalent of `docker exec` targeting a Compose service.
#### Options
| Option | Description |
| ------------------- | ---------------------------------------------------------------- |
| `-d, --detach` | Detached mode: Run command in the background. |
| `-e, --env` | Set [environment variables](../linux/Environment%20Variables.md) |
| `-i, --interactive` | Keep STDIN open even if not attached. |
| `-t, --tty` | Allocate a pseudo-TTY. |
| `-u, --user` | Run the command as this user. |
| `-w, --workdir` | Path to workdir directory for this command. |
### `docker-compose logs`
Displays log output from services.
#### Options
| Option | Description |
| ---------------- | ---------------------------------------------------------------------------------------------- |
| `-f, --follow` | Follow log output |
| `--since ts` | Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) |
| `-n, --tail num` | Number of lines to show from the end of the logs |
| `--until` | Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) |
### `docker-compose kill`
Force stop service containers.
### `docker-compose ps`
List running containers
### `docker-compose pull`
Pull service images
### `docker-compose restart`
Restart service containers
## Docker Compose file
The Compose file is a [YAML](../files/YAML.md) file defining:
@ -76,7 +138,7 @@ devices:
```
### `entrypoint`
`entrypoint` declares the default entrypoint for the service container. This overrides the ENTRYPOINT instruction from the service's Dockerfile.
`entrypoint` declares the default entrypoint for the service container. This overrides the ENTRYPOINT instruction from the service's [Dockerfile](Dockerfile.md).
If entrypoint is non-null, Compose ignores any default command from the image, for example the CMD instruction in the [Dockerfile](Dockerfile.md).