ENGDOCS-1069 (#16436)

* ENGDOCS-1069

* fixes from code review
This commit is contained in:
Allie Sadler 2023-01-09 13:17:55 +00:00 committed by GitHub
parent d20b9da876
commit 2cad646039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 52 deletions

View File

@ -902,8 +902,6 @@ reference:
title: Compose file build title: Compose file build
- path: /compose/compose-file/deploy/ - path: /compose/compose-file/deploy/
title: Compose file deploy title: Compose file deploy
- path: /compose/faq/
title: Frequently asked questions
- sectiontitle: Legacy versions - sectiontitle: Legacy versions
section: section:
- path: /compose/compose-file/compose-versioning/ - path: /compose/compose-file/compose-versioning/
@ -1705,6 +1703,8 @@ manuals:
title: Control startup order title: Control startup order
- path: /compose/samples-for-compose/ - path: /compose/samples-for-compose/
title: Sample apps with Compose title: Sample apps with Compose
- path: /compose/faq/
title: FAQs
- path: /compose/release-notes/ - path: /compose/release-notes/
title: Release notes title: Release notes

View File

@ -4,26 +4,53 @@ keywords: documentation, docs, docker, compose, faq
title: Frequently asked questions title: Frequently asked questions
--- ---
If you dont see your question here, feel free to drop by ## How do I get help?
[#docker-compose](https://dockercommunity.slack.com/archives/C2X82D9PA) on the
[Docker Community Slack](https://dockr.ly/slack).
Docker Compose is under active development. If you need help, would like to
contribute, or simply want to talk about the project with like-minded
individuals, we have a number of open channels for communication.
## Can I control service startup order? * To report bugs or file feature requests, use the [issue tracker on Github](https://github.com/docker/compose/issues){: target="blank" rel="noopener" class="_" }.
Yes - see [Controlling startup order](startup-order.md). * To talk about the project with people in real time, join the
`#docker-compose` channel on the [Docker Community Slack](https://dockr.ly/slack){: target="blank" rel="noopener" class="_" }.
* To contribute code submit a [pull request on Github](https://github.com/docker/compose/pulls){: target="blank" rel="noopener" class="_" }.
## Where can I find example Compose files?
There are [many examples of Compose files on GitHub](https://github.com/docker/awesome-compose){: target="blank" rel="noopener" class="_" }.
## What's the difference between `up`, `run`, and `start`?
Typically, you want `docker compose up`. Use `up` to start or restart all the
services defined in a `docker-compose.yml`. In the default "attached"
mode, you see all the logs from all the containers. In "detached" mode (`-d`),
Compose exits after starting the containers, but the containers continue to run
in the background.
The `docker compose run` command is for running "one-off" or "adhoc" tasks. It
requires the service name you want to run and only starts containers for services
that the running service depends on. Use `run` to run tests or perform
an administrative task such as removing or adding data to a data volume
container. The `run` command acts like `docker run -ti` in that it opens an
interactive terminal to the container and returns an exit status matching the
exit status of the process in the container.
The `docker compose start` command is useful only to restart containers
that were previously created, but were stopped. It never creates new
containers.
## Why do my services take 10 seconds to recreate or stop? ## Why do my services take 10 seconds to recreate or stop?
Compose stop attempts to stop a container by sending a `SIGTERM`. It then waits The `docker compose stop` command attempts to stop a container by sending a `SIGTERM`. It then waits
for a [default timeout of 10 seconds](../engine/reference/commandline/compose_stop.md). After the timeout, for a [default timeout of 10 seconds](../engine/reference/commandline/compose_stop.md). After the timeout,
a `SIGKILL` is sent to the container to forcefully kill it. If you a `SIGKILL` is sent to the container to forcefully kill it. If you
are waiting for this timeout, it means that your containers aren't shutting down are waiting for this timeout, it means that your containers aren't shutting down
when they receive the `SIGTERM` signal. when they receive the `SIGTERM` signal.
There has already been a lot written about this problem of There has already been a lot written about this problem of
[processes handling signals](https://medium.com/@gchudnov/trapping-signals-in-docker-containers-7a57fdda7d86) [processes handling signals](https://medium.com/@gchudnov/trapping-signals-in-docker-containers-7a57fdda7d86){: target="blank" rel="noopener" class="_" }
in containers. in containers.
To fix this problem, try the following: To fix this problem, try the following:
@ -49,11 +76,15 @@ services:
``` ```
* If you can't modify the application, wrap the application in a lightweight init * If you can't modify the application, wrap the application in a lightweight init
system (like [s6](https://skarnet.org/software/s6/)) or a signal proxy (like system (like [s6](https://skarnet.org/software/s6/){: target="blank" rel="noopener" class="_" }) or a signal proxy (like
[dumb-init](https://github.com/Yelp/dumb-init) or [dumb-init](https://github.com/Yelp/dumb-init){: target="blank" rel="noopener" class="_" } or
[tini](https://github.com/krallin/tini)). Either of these wrappers takes care of [tini](https://github.com/krallin/tini){: target="blank" rel="noopener" class="_" }). Either of these wrappers takes care of
handling `SIGTERM` properly. handling `SIGTERM` properly.
## Can I control service startup order?
Yes, see [Controlling startup order](startup-order.md).
## How do I run multiple copies of a Compose file on the same host? ## How do I run multiple copies of a Compose file on the same host?
Compose uses the project name to create unique identifiers for all of a Compose uses the project name to create unique identifiers for all of a
@ -61,29 +92,9 @@ project's containers and other resources. To run multiple copies of a project,
set a custom project name using the [`-p` command line option](reference/index.md) set a custom project name using the [`-p` command line option](reference/index.md)
or the [`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name). or the [`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name).
## What's the difference between `up`, `run`, and `start`?
Typically, you want `docker compose up`. Use `up` to start or restart all the
services defined in a `docker-compose.yml`. In the default "attached"
mode, you see all the logs from all the containers. In "detached" mode (`-d`),
Compose exits after starting the containers, but the containers continue to run
in the background.
The `docker compose run` command is for running "one-off" or "adhoc" tasks. It
requires the service name you want to run and only starts containers for services
that the running service depends on. Use `run` to run tests or perform
an administrative task such as removing or adding data to a data volume
container. The `run` command acts like `docker run -ti` in that it opens an
interactive terminal to the container and returns an exit status matching the
exit status of the process in the container.
The `docker compose start` command is useful only to restart containers
that were previously created, but were stopped. It never creates new
containers.
## Can I use JSON instead of YAML for my Compose file? ## Can I use JSON instead of YAML for my Compose file?
Yes. [YAML is a superset of JSON](https://stackoverflow.com/a/1729545/444646) so Yes. [YAML is a superset of JSON](https://stackoverflow.com/a/1729545/444646){: target="blank" rel="noopener" class="_" } so
any JSON file should be valid YAML. To use a JSON file with Compose, any JSON file should be valid YAML. To use a JSON file with Compose,
specify the filename to use, for example: specify the filename to use, for example:
@ -107,25 +118,6 @@ include the code using a `COPY`, and use a `volume` in your Compose file to
include the code from the host during development. The volume overrides include the code from the host during development. The volume overrides
the directory contents of the image. the directory contents of the image.
## Where can I find example compose files?
There are [many examples of Compose files on
GitHub](https://github.com/search?q=in%3Apath+docker-compose.yml+extension%3Ayml&type=Code).
## Getting help
Docker Compose is under active development. If you need help, would like to
contribute, or simply want to talk about the project with like-minded
individuals, we have a number of open channels for communication.
* To report bugs or file feature requests: use the [issue tracker on Github](https://github.com/docker/compose/issues).
* To talk about the project with people in real time: join the
`#docker-compose` channel on the Docker Community Slack.
* To contribute code or documentation changes: submit a [pull request on Github](https://github.com/docker/compose/pulls).
## Compose documentation ## Compose documentation
- [User guide](index.md) - [User guide](index.md)