Skip to content

Commit

Permalink
chore(docs): add docs on the Docker integrations for the new CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkdev98 committed Sep 10, 2023
1 parent 1ec564e commit d952592
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions docs/docs/integrations/docker.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Docker
# Docker integration

- `compas init docker`
- Config file
- Resetting the containers
Most of the time your application requires external services. Compas supports
automatically spinning up those external services via
[Docker](https://docs.docker.com/).

## Getting started

The docker integration is not enabled by default. You can run the following
command or apply the config changes below manually.

```shell
compas init docker
```

This creates or updates the Compas config file in `config/compas.json` with the
following contents:

```json
{
"dockerContainers": {
"compas-postgres-15": {
"createArguments": "-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/pgdata -v compas-postgres-15:/var/lib/postgresql/data/pgdata -p 5432:5432",
"image": "postgres:15"
}
}
}
```

## Config

Each container definition has the following properties:

- The image name, in the above example 'compas-postgres-15'. This name should
either be unique over all your projects, or the container is reused across
projects that specify the same name. This may be the desired behavior if you
work on multiple projects that share the same set of services.
- `createArguments`: Arguments to pass to the `docker create` command. See the
[Docker documentation](https://docs.docker.com/engine/reference/commandline/create/)
for more information. The `--name` argument and image are provided by Compas.
- `image`: The image to create the container from. Anything that Docker supports
works. It is advised to develop against the same versions as your production
environment will have.

## Limitations

- Compas currently does not have any behavior to automatically stop containers.
- The Docker containers will still run in the background even though you stopped
the development CLI. This could cause conflicts with for example used ports
when you start working on a different project. You can stop containers with
`docker stop $name` and remove them with `docker rm $name`.

0 comments on commit d952592

Please sign in to comment.