diff --git a/content/get-started/02_our_app.md b/content/get-started/02_our_app.md index 5fa419060d..1a9baf000a 100644 --- a/content/get-started/02_our_app.md +++ b/content/get-started/02_our_app.md @@ -47,7 +47,7 @@ To build the image, you'll need to use a Dockerfile. A Dockerfile is simply a te 1. In the `getting-started-app` directory, the same location as the `package.json` file, create a file named `Dockerfile`. You can use the following commands to create a Dockerfile based on your operating system. {{< tabs >}} - {{< tab name="Mac / Linux" >}} + {{< tab name="Mac / Linux / Windows (Git Bash)" >}} In the terminal, run the following commands. @@ -64,7 +64,7 @@ To build the image, you'll need to use a Dockerfile. A Dockerfile is simply a te ``` {{< /tab >}} - {{< tab name="Windows" >}} + {{< tab name="Windows (Command Prompt)" >}} In the Windows Command Prompt, run the following commands. @@ -80,6 +80,23 @@ To build the image, you'll need to use a Dockerfile. A Dockerfile is simply a te $ type nul > Dockerfile ``` + {{< /tab >}} + {{< tab name="Windows (PowerShell)" >}} + + In PowerShell, run the following commands. + + Make sure you're in the `getting-started-app` directory. Replace `\path\to\getting-started-app` with the path to your `getting-started-app` directory. + + ```console + $ cd \path\to\getting-started-app + ``` + + Create an empty file named `Dockerfile`. + + ```powershell + $ New-Item -Path . -Name Dockerfile -ItemType File + ``` + {{< /tab >}} {{< /tabs >}} diff --git a/content/get-started/04_sharing_app.md b/content/get-started/04_sharing_app.md index 709fa656bb..0117a58490 100644 --- a/content/get-started/04_sharing_app.md +++ b/content/get-started/04_sharing_app.md @@ -35,7 +35,7 @@ In the following image, you can see an example Docker command from Docker Hub. T ## Push the image 1. In the command line, run the `docker push` command that you see on Docker - Hub. Note that your command will have your Docker ID, not "docker". + Hub. Note that your command will have your Docker ID, not "docker". For example, `docker push YOUR-USER-NAME/getting-started`. ```console $ docker push docker/getting-started @@ -71,7 +71,7 @@ new instance that has never seen this container image. To do this, you will use > **Note** > -> Play with Docker uses the amd64 platform. If you are using an ARM based Mac with Apple Silicon, you will need to rebuild the image to be compatible with Play with Docker and push the new image to your repository. +> Play with Docker uses the amd64 platform. If you are using an ARM based Mac with Apple silicon, you will need to rebuild the image to be compatible with Play with Docker and push the new image to your repository. > > To build an image for the amd64 platform, use the `--platform` flag. > ```console diff --git a/content/get-started/06_bind_mounts.md b/content/get-started/06_bind_mounts.md index ca827be504..7bd76fae37 100644 --- a/content/get-started/06_bind_mounts.md +++ b/content/get-started/06_bind_mounts.md @@ -74,11 +74,11 @@ setting, see the topic for [Mac](../desktop/settings/mac.md/#file-sharing), ``` {{< /tab >}} - {{< tab name="Windows (CMD)" >}} + {{< tab name="Windows (Command Prompt)" >}} - ```Command Prompt - > docker run -it --mount "type=bind,src=%cd%,target=/src" ubuntu bash + ```console + $ docker run -it --mount "type=bind,src=%cd%,target=/src" ubuntu bash ``` {{< /tab >}} diff --git a/content/get-started/07_multi_container.md b/content/get-started/07_multi_container.md index c5e368ee6f..5757e47042 100644 --- a/content/get-started/07_multi_container.md +++ b/content/get-started/07_multi_container.md @@ -56,9 +56,7 @@ In the following steps, you'll create the network first and then attach the MySQ ``` {{< /tab >}} - {{< tab name="Windows" >}} - - In Windows, run this command in PowerShell. + {{< tab name="Windows (PowerShell)" >}} ```powershell $ docker run -d ` @@ -69,6 +67,18 @@ In the following steps, you'll create the network first and then attach the MySQ mysql:8.0 ``` + {{< /tab >}} + {{< tab name="Windows (Command Prompt)" >}} + + ```console + $ docker run -d ^ + --network todo-app --network-alias mysql ^ + -v todo-mysql-data:/var/lib/mysql ^ + -e MYSQL_ROOT_PASSWORD=secret ^ + -e MYSQL_DATABASE=todos ^ + mysql:8.0 + ``` + {{< /tab >}} {{< /tabs >}} @@ -209,7 +219,7 @@ You can now start your dev-ready container. ``` {{< /tab >}} - {{< tab name="Windows" >}} + {{< tab name="Windows (PowerShell)" >}} In Windows, run this command in PowerShell. ```powershell @@ -224,6 +234,22 @@ You can now start your dev-ready container. sh -c "yarn install && yarn run dev" ``` + {{< /tab >}} + {{< tab name="Windows (Command Prompt)" >}} + In Windows, run this command in Command Prompt. + + ```console + $ docker run -dp 127.0.0.1:3000:3000 ^ + -w /app -v "%cd%:/app" ^ + --network todo-app ^ + -e MYSQL_HOST=mysql ^ + -e MYSQL_USER=root ^ + -e MYSQL_PASSWORD=secret ^ + -e MYSQL_DB=todos ^ + node:18-alpine ^ + sh -c "yarn install && yarn run dev" + ``` + {{< /tab >}} {{< /tabs >}} diff --git a/content/get-started/08_using_compose.md b/content/get-started/08_using_compose.md index 058b7770fa..0968808fa2 100644 --- a/content/get-started/08_using_compose.md +++ b/content/get-started/08_using_compose.md @@ -51,7 +51,6 @@ You'll now define this service in the `compose.yaml` file. The name will automatically become a network alias, which will be useful when defining your MySQL service. ```yaml - services: app: image: node:18-alpine diff --git a/content/language/dotnet/containerize.md b/content/language/dotnet/containerize.md index 0badcbc392..bb8376abf6 100644 --- a/content/language/dotnet/containerize.md +++ b/content/language/dotnet/containerize.md @@ -38,7 +38,9 @@ $ git clone https://github.com/docker/docker-dotnet-sample Now that you have an application, you can use `docker init` to create the necessary Docker assets to containerize your application. Inside the `docker-dotnet-sample` directory, run the `docker init` command in a terminal. -Refer to the following example to answer the prompts from `docker init`. +`docker init` provides some default configuration, but you'll need to answer a +few questions about your application. Refer to the following example to answer +the prompts from `docker init` and use the same answers for your prompts. ```console $ docker init diff --git a/content/language/nodejs/containerize.md b/content/language/nodejs/containerize.md index 8e5c31e35e..ed38b07dc2 100644 --- a/content/language/nodejs/containerize.md +++ b/content/language/nodejs/containerize.md @@ -35,7 +35,9 @@ $ git clone https://github.com/docker/docker-nodejs-sample Now that you have an application, you can use `docker init` to create the necessary Docker assets to containerize your application. Inside the `docker-nodejs-sample` directory, run the `docker init` command in a terminal. -Refer to the following example to answer the prompts from `docker init`. +`docker init` provides some default configuration, but you'll need to answer a +few questions about your application. Refer to the following example to answer +the prompts from `docker init` and use the same answers for your prompts. ```console $ docker init diff --git a/content/language/python/containerize.md b/content/language/python/containerize.md index ee8b268832..2e573ffebd 100644 --- a/content/language/python/containerize.md +++ b/content/language/python/containerize.md @@ -28,7 +28,13 @@ $ git clone https://github.com/docker/python-docker ## Initialize Docker assets -Now that you have an application, you can use `docker init` to create the necessary Docker assets to containerize your application. Inside the `python-docker` directory, run the `docker init` command. Refer to the following example to answer the prompts from `docker init`. +Now that you have an application, you can use `docker init` to create the +necessary Docker assets to containerize your application. Inside the +`python-docker` directory, run the `docker init` command. `docker init` provides +some default configuration, but you'll need to answer a few questions about your +application. For example, this application uses Flask to run. Refer to the +following example to answer the prompts from `docker init` and use the same +answers for your prompts. ```console $ docker init diff --git a/content/language/python/develop.md b/content/language/python/develop.md index f0ae5a6c06..e6e4978b55 100644 --- a/content/language/python/develop.md +++ b/content/language/python/develop.md @@ -51,7 +51,7 @@ You can use containers to set up local services, like a database. In this sectio In the cloned repository's directory, open the `compose.yaml` file in an IDE or text editor. `docker init` handled creating most of the instructions, but you'll need to update it for your unique application. -In the `compose.yaml` file, you need to uncomment all of the database instructions. In addition, you need to add the database password as an environment variable to the server service. +In the `compose.yaml` file, you need to uncomment all of the database instructions. In addition, you need to add the database password file as an environment variable to the server service and specify the secret file to use . The following is the updated `compose.yaml` file. @@ -63,10 +63,12 @@ services: ports: - 5000:5000 environment: - - POSTGRES_PASSWORD=mysecretpassword + - POSTGRES_PASSWORD_FILE=/run/secrets/db-password depends_on: db: condition: service_healthy + secrets: + - db-password db: image: postgres restart: always @@ -163,10 +165,12 @@ services: ports: - 5000:5000 environment: - - POSTGRES_PASSWORD=mysecretpassword + - POSTGRES_PASSWORD_FILE=/run/secrets/db-password depends_on: db: condition: service_healthy + secrets: + - db-password develop: watch: - action: rebuild diff --git a/content/language/rust/build-images.md b/content/language/rust/build-images.md index 0d657f0c83..da6068784c 100644 --- a/content/language/rust/build-images.md +++ b/content/language/rust/build-images.md @@ -25,7 +25,12 @@ $ git clone https://github.com/docker/docker-rust-hello ## Create a Dockerfile for Rust -Now that you have an application, you can use `docker init` to create a Dockerfile for it. Inside the `docker-rust-hello` directory, run the `docker init` command. Refer to the following example to answer the prompts from `docker init`. +Now that you have an application, you can use `docker init` to create a +Dockerfile for it. Inside the `docker-rust-hello` directory, run the `docker +init` command. `docker init` provides some default configuration, but you'll +need to answer a few questions about your application. Refer to the following +example to answer the prompts from `docker init` and use the same answers for +your prompts. ```console $ docker init