From 2cad646039adf9e16c04709ffdd429eaf51466c7 Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:17:55 +0000 Subject: [PATCH] ENGDOCS-1069 (#16436) * ENGDOCS-1069 * fixes from code review --- _data/toc.yaml | 4 +-- compose/faq.md | 92 +++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 52 deletions(-) diff --git a/_data/toc.yaml b/_data/toc.yaml index 1184934fdc..c8800302b3 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -902,8 +902,6 @@ reference: title: Compose file build - path: /compose/compose-file/deploy/ title: Compose file deploy - - path: /compose/faq/ - title: Frequently asked questions - sectiontitle: Legacy versions section: - path: /compose/compose-file/compose-versioning/ @@ -1705,6 +1703,8 @@ manuals: title: Control startup order - path: /compose/samples-for-compose/ title: Sample apps with Compose + - path: /compose/faq/ + title: FAQs - path: /compose/release-notes/ title: Release notes diff --git a/compose/faq.md b/compose/faq.md index eeef5795d9..909fd6615f 100644 --- a/compose/faq.md +++ b/compose/faq.md @@ -4,26 +4,53 @@ keywords: documentation, docs, docker, compose, faq title: Frequently asked questions --- -If you don’t see your question here, feel free to drop by -[#docker-compose](https://dockercommunity.slack.com/archives/C2X82D9PA) on the -[Docker Community Slack](https://dockr.ly/slack). +## How do I get 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. -## 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? -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, 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 when they receive the `SIGTERM` signal. 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. 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 -system (like [s6](https://skarnet.org/software/s6/)) or a signal proxy (like -[dumb-init](https://github.com/Yelp/dumb-init) or -[tini](https://github.com/krallin/tini)). Either of these wrappers takes care of +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){: target="blank" rel="noopener" class="_" } or +[tini](https://github.com/krallin/tini){: target="blank" rel="noopener" class="_" }). Either of these wrappers takes care of 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? 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) 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? -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, 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 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 - [User guide](index.md)