mirror of https://github.com/docker/docs.git
Address review comments
Signed-off-by: Usha Mandya <usha.mandya@docker.com>
This commit is contained in:
parent
60624cfb4a
commit
5a07a993b3
|
@ -67,9 +67,9 @@ For now, we will create the network first and attach the MySQL container at star
|
|||
|
||||
You'll also see we specified the `--network-alias` flag. We'll come back to that in just a moment.
|
||||
|
||||
>**Note**
|
||||
> **Tip**
|
||||
>
|
||||
>You'll notice we're using a volume named `todo-mysql-data` here and mounting it at `/var/lib/mysql`, which is where MySQL stores its data. However, we never ran a `docker volume create` command. Docker recognizes we want to use a named volume and creates one automatically for us.
|
||||
> You'll notice we're using a volume named `todo-mysql-data` here and mounting it at `/var/lib/mysql`, which is where MySQL stores its data. However, we never ran a `docker volume create` command. Docker recognizes we want to use a named volume and creates one automatically for us.
|
||||
|
||||
3. To confirm we have the database up and running, connect to the database and verify it connects.
|
||||
|
||||
|
@ -161,12 +161,20 @@ The todo app supports the setting of a few environment variables to specify MySQ
|
|||
- `MYSQL_PASSWORD` - the password to use for the connection
|
||||
- `MYSQL_DB` - the database to use once connected
|
||||
|
||||
>**Warning**
|
||||
> **Setting Connection Settings via Env Vars**
|
||||
>
|
||||
>**Setting Connection Settings via Env Vars**
|
||||
> While using env vars to set connection settings is generally ok for development, it is **HIGHLY DISCOURAGED**
|
||||
> when running applications in production. Diogo Monica, the former lead of security at Docker,
|
||||
> [wrote a fantastic blog post](https://diogomonica.com/2017/03/27/why-you-shouldnt-use-env-variables-for-secret-data/):target="_blank" rel="noopener" class="_"}
|
||||
> explaining why.
|
||||
>
|
||||
>While using env vars to set connection settings is generally ok for development, it is **HIGHLY DISCOURAGED** when running applications in production. Diogo Monica, the former lead of security at Docker, [wrote a fantastic blog post](https://diogomonica.com/2017/03/27/why-you-shouldnt-use-env-variables-for-secret-data/){:target="_blank" rel="noopener" class="_"} explaining why. A more secure mechanism is to use the secret support provided by your container orchestration framework. In most cases, these secrets are mounted as files in the running container. You'll see many apps (including the MySQL image and the todo app) also support env vars with a `_FILE` suffix to point to a file containing the variable. As an example, setting the `MYSQL_PASSWORD_FILE` var will cause the app to use the contents of the referenced file as the connection password. Docker doesn't do anything to support these env vars. Your app will need to know to look for the variable and get the file contents.
|
||||
{: .warning}
|
||||
> A more secure mechanism is to use the secret support provided by your container orchestration framework. In most cases,
|
||||
> these secrets are mounted as files in the running container. You'll see many apps (including the MySQL image and the todo app)
|
||||
> also support env vars with a `_FILE` suffix to point to a file containing the variable.
|
||||
>
|
||||
> As an example, setting the `MYSQL_PASSWORD_FILE` var will cause the app to use the contents of the referenced file
|
||||
> as the connection password. Docker doesn't do anything to support these env vars. Your app will need to know to look for
|
||||
> the variable and get the file contents.
|
||||
|
||||
With all of that explained, let's start our dev-ready container!
|
||||
|
||||
|
|
|
@ -310,9 +310,14 @@ Now that we have our `docker-compose.yml` file, we can start it up!
|
|||
view the logs for a specific service, you can add the service name to the end of the logs command (for example,
|
||||
`docker-compose logs -f app`).
|
||||
|
||||
>**Waiting for the DB before starting the app**
|
||||
> **Tip: Waiting for the DB before starting the app**
|
||||
>
|
||||
>When the app is starting up, it actually sits and waits for MySQL to be up and ready before trying to connect to it. Docker doesn't have any built-in support to wait for another container to be fully up, running, and ready before starting another container. For Node-based projects, you can use the [wait-port](https://github.com/dwmkerr/wait-port){:target="_blank" rel="noopener" class="_"} dependency. Similar projects exist for other languages/frameworks.
|
||||
> When the app is starting up, it actually sits and waits for MySQL to be up
|
||||
> and ready before trying to connect to it. Docker doesn't have any built-in
|
||||
> support to wait for another container to be fully up, running, and ready
|
||||
> before starting another container. For Node-based projects, you can use
|
||||
> the [wait-port](https://github.com/dwmkerr/wait-port){:target="_blank" rel="noopener" class="_"}
|
||||
> dependency. Similar projects exist for other languages/frameworks.
|
||||
|
||||
4. At this point, you should be able to open your app and see it running. And hey! We're down to a single command!
|
||||
|
||||
|
|
|
@ -68,15 +68,18 @@ We also recommend the video walkthrough from DockerCon 2020.
|
|||
|
||||
In this tutorial, you'll learn about creating and deploying Docker apps, including using multiple containers with a database, and using Docker Compose. You'll also deploy your containerized app to Azure.
|
||||
|
||||
## Download Docker
|
||||
## Download and install Docker
|
||||
|
||||
You can download and install Docker on multiple platforms. Choose your preferred operating system below.
|
||||
This tutorial assumes you have a current version of Docker installed on your
|
||||
machine. If you do not have Docker installed, choose your preferred operating system below to download Docker:
|
||||
|
||||
- [Mac](https://desktop.docker.com/mac/stable/Docker.dmg)
|
||||
- [Download Docker Desktop for Mac](https://desktop.docker.com/mac/stable/Docker.dmg)
|
||||
|
||||
- [Windows](https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe)
|
||||
- [Download Docker Desktop for Windows](https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe)
|
||||
|
||||
- [Linux](../engine/install/index.md)
|
||||
- [Install Docker Engine on Linux](../engine/install/index.md)
|
||||
|
||||
For Docker Desktop installation instructions, see [Install Docker Desktop on Mac](../docker-for-mac/install.md) and [Install Docker Desktop on Windows](../docker-for-windows/install.md).
|
||||
|
||||
## Start the tutorial
|
||||
|
||||
|
@ -92,14 +95,13 @@ You'll notice a few flags being used. Here's some more info on them:
|
|||
- `-p 80:80` - map port 80 of the host to port 80 in the container
|
||||
- `docker/getting-started` - the image to use
|
||||
|
||||
>**Pro tip**
|
||||
>
|
||||
>You can combine single character flags to shorten the full command.
|
||||
>As an example, the command above could be written as:
|
||||
>```
|
||||
>docker run -dp 80:80 docker/getting-started
|
||||
>```
|
||||
> **Tip**
|
||||
>
|
||||
> You can combine single character flags to shorten the full command.
|
||||
> As an example, the command above could be written as:
|
||||
> ```
|
||||
> docker run -dp 80:80 docker/getting-started
|
||||
> ```
|
||||
|
||||
## The Docker Dashboard
|
||||
|
||||
|
|
Loading…
Reference in New Issue