doc-freshness: get-started and lang guides (#19077)

* tier 2 freshness for get started and language guides

---------

Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
This commit is contained in:
Craig Osterhout 2024-01-12 07:21:22 -08:00 committed by GitHub
parent 99dc1f8c68
commit 28d37919b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 80 additions and 19 deletions

View File

@ -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 >}}

View File

@ -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

View File

@ -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 >}}

View File

@ -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 >}}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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