Improve docker compose reference

This commit is contained in:
mjanez 2023-03-17 12:17:23 +00:00 committed by GitHub
parent 87fc684ab0
commit 9af99bfba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 21 deletions

View File

@ -96,26 +96,49 @@ docker network prune # Clear unused networks
More info about Docker Compose commands at [docker compose reference](https://docs.docker.com/compose/reference/). More info about Docker Compose commands at [docker compose reference](https://docs.docker.com/compose/reference/).
```bash ```bash
# Starts existing containers for a service. # Basic. All containers or specific container: <container>
docker compose start ## Starts existing containers for a service.
docker compose start <container>
# Stops running containers without removing them. ## Restarts existing containers/container for a service.
docker compose stop docker compose restart <container>
# Pauses running containers of a service. ## Stops running containers without removing them.
docker compose pause docker compose stop <container>
# Unpauses paused containers of a service. ## Pauses running containers of a service.
docker compose unpause docker compose pause <container>
# Lists containers. ## Unpauses paused containers of a service.
docker compose unpause <container>
# Display the logs of a container. Is it possible to retrieve only the last n seconds or other
docker logs [--since 60s] <container> -f
## Lists containers.
docker compose ps docker compose ps
# Builds, (re)creates, starts, and attaches to containers for a service. ## Remove all docker compose project
docker compose up docker compose rm <container>
# Build.
## Builds, (re)creates, starts, and attaches to containers for a service.
docker compose [-f <docker compose-file>] up
## Build & up all the containers.
docker compose [-f <docker compose-file>] up -d --build
## To avoid using a cache of the previous build while creating a new image.
docker compose [-f <docker compose-file>] build --no-cache
## Build a project with a specific Docker Compose prefix.
docker compose [-f <docker compose-file>] -p <my_project> up -d --build
# Down
# Stops containers and removes containers, networks, volumes, and images created by up. # Stops containers and removes containers, networks, volumes, and images created by up.
docker compose down docker compose [-p <my_project>] down
``` ```
## Install (build and run) CKAN plus dependencies ## Install (build and run) CKAN plus dependencies
@ -166,15 +189,6 @@ To start the containers:
See [CKAN Images](#ckan-images) for more details of what happens when using development mode. See [CKAN Images](#ckan-images) for more details of what happens when using development mode.
**docker/docker compose commands**
* `docker compose [-f <docker compose-file>] up -d --build`: to build & up all the containers.
* `docker compose [-f <docker compose-file>] build --no-cache`: to avoid using a cache of the previous build while creating a new image.
* `docker compose -p <my_project> up -d --build`: to build a project with a specific Docker Compose prefix.
* `docker compose restart <container>`: to restart only a specific container.
* `docker compose rm`: to remove all docker compose project.
* `docker compose [-p <my_project>] down`: to down all containers
* `docker logs --since 60s <container> -f `: to display the logs of a container for the last n seconds.
#### Create an extension #### Create an extension
You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output: You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output: