This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/reference/universe/docker/compose.md
Tom Chauveau 020c458921 Add project management in compose.#App definition
I found an issue when during tests execution : there was orphan.
It's because #App doesn't give way to specify the compose project,
by default it's the directory where you launch your app but in our
definition, it will always be source.

The problem is that if we launch two differents docker-compose in the same
server, his project name will be source for both and it will create
orphans problems on cleanup (by docker-compose down).

This case is exactly what we do in tests so I've add the field name
to specify the projet name and avoid that issue.

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-26 16:07:14 +02:00

41 lines
1.9 KiB
Markdown

---
sidebar_label: compose
---
# alpha.dagger.io/docker/compose
Docker-compose operations
```cue
import "alpha.dagger.io/docker/compose"
```
## compose.#App
### compose.#App Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*name* | `*"source" \| string` |App name (use as COMPOSE_PROJECT_NAME) |
|*registries* | `[]` |Image registries |
|*run.command* | `"""\n if [ -n "$DOCKER_HOSTNAME" ]; then\n \tssh -i /key -fNT -o "StreamLocalBindUnlink=yes" -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME"\n \texport DOCKER_HOST="unix://$(pwd)/docker.sock"\n fi\n \n # Extend session duration\n echo "Host *\\nServerAliveInterval 240" \>\> "$HOME"/.ssh/config\n chmod 600 "$HOME"/.ssh/config\n \n # Move compose\n if [ -d "$SOURCE_DIR" ]; then\n \tif [ -f docker-compose.yaml ]; then\n \t\tcp docker-compose.yaml "$SOURCE_DIR"/docker-compose.yaml\n \tfi\n \tcd "$SOURCE_DIR"\n fi\n \n docker-compose build\n docker-compose up -d\n """` |Command to execute |
|*run.env.COMPOSE_PROJECT_NAME* | `*"source" \| string` |- |
|*run.package."docker-compose"* | `true` |- |
|*run.registries* | `[]` |Image registries |
### compose.#App Outputs
_No output._
## compose.#Client
A container image to run the docker-compose client
### compose.#Client Inputs
_No input._
### compose.#Client Outputs
_No output._