This commit is contained in:
Gordon Hogenson 2020-04-20 14:33:49 -07:00
Родитель a755312db6
Коммит ec371d6b36
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -9,7 +9,7 @@ MetaDescription: Develop a multi-container app running in a Docker containers us
Docker Compose provides a way to orchestrate multiple containers that work together. Examples include a service that processes requests and a front-end web site, or a service that uses a supporting function such as a Redis cache. If you are using the microservices model for your app development, you can use Docker Compose to factor the app code into several independently running services that communicate using web requests. This article helps you enable Docker Compose for your apps, whether they are Node.js, Python, or .NET Core, and also helps you configure debugging in VS Code for these scenarios.
Also, for single container scenarios, using Docker Compose provides tool-independent configuration in a way that a single Dockerfile does not. Configuration settings such as volume mounts for the container, port mappings, and environment variables can be declared in the docker-compose YML files.
Also, for single-container scenarios, using Docker Compose provides tool-independent configuration in a way that a single Dockerfile does not. Configuration settings such as volume mounts for the container, port mappings, and environment variables can be declared in the docker-compose YML files.
To use Docker Compose in VS Code using the Docker extension, you should already be familiar with the basics of [Docker Compose](https://docs.docker.com/compose/).
@ -24,7 +24,7 @@ The Docker extension adds the following files to your workspace:
- *docker-compose.yml* – Brings up the containers as expected in production.
- *docker-compose.debug.yml* – Provides a simplified mode for starting that enables the debugger. This is not available with Python. For Python, see [How to debug your app with Gunicorn](/docs/containers/debug-python.md#how-to-debug-your-app-with-gunicorn).
![Screenshot of project with docker-compose files](./images/compose/docker-compose-files.png)
![Screenshot of project with docker-compose files](images/compose/docker-compose-files.png)
The VS Code Docker extension generates files that work out of the box, but you can also customize them to optimize for your scenario. You can then use the **Docker Compose Up** command (right-click on the *docker-compose.yml* file, or find the command in the Command Palette). You can also use the `docker-compose up` command from the command prompt or terminal window in VS Code to start the containers. Refer to the [Docker Compose docs](https://docs.docker.com/compose/up) about how to configure the Docker Compose behavior and what command-line options are available.
@ -120,7 +120,7 @@ Create an **Attach** [launch configuration](/docs/editor/debugging.md#launch-con
When you attach to a service that exposes an HTTP endpoint that returns HTML, the web browser doesn't open automatically, so you need to start the browser on the host and navigate to the app at `http://localhost:{port}`, where the `port` is found by inspecting the .json configuration for the running container as described previously.
![Screenshot of debug session](./images/compose/docker-compose-debugging.png)
![Screenshot of debug session](images/compose/docker-compose-debugging.png)
You can also use the `docker port` command, for example: