-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): add docs on the Docker integrations for the new CLI
- Loading branch information
Showing
1 changed file
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |