docs: update docs of README.mds.

summary: update command docker compose to docker-compose.
This commit is contained in:
Mark
2023-01-05 22:29:01 +08:00
parent 20e3e4c434
commit 4b0c67e2aa
40 changed files with 518 additions and 332 deletions

View File

@@ -9,6 +9,7 @@ You can open this sample in the Dev Environments feature of Docker Desktop versi
### TRAEFIK proxy with GO backend
Project structure:
```
.
├── backend
@@ -19,6 +20,7 @@ Project structure:
```
[_compose.yaml_](compose.yaml)
```
services:
frontend:
@@ -40,6 +42,7 @@ services:
- "traefik.http.services.go.loadbalancer.server.port=80"
```
The compose file defines an application with two services `frontend` and `backend`.
When deploying the application, docker compose maps port 80 of the frontend service container to the same port of the host as specified in the file.
Make sure port 80 on the host is not already being in use.
@@ -47,7 +50,7 @@ Make sure port 80 on the host is not already being in use.
## Deploy with docker compose
```
$ docker compose up -d
$ docker-compose up -d
Creating network "traefik-golang_default" with the default driver
Building backend
Step 1/7 : FROM golang:1.13 AS build
@@ -71,6 +74,7 @@ Creating traefik-golang_frontend_1 ... done
## Expected result
Listing containers must show two containers running and the port mapping as below:
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
@@ -79,6 +83,7 @@ e0a0f3191042 traefik:2.6 "/entrypoint.sh --pr…" 42 seconds ag
```
After the application starts, navigate to `http://localhost:80` in your web browser or run:
```
$ curl localhost:80
@@ -96,6 +101,7 @@ Hello from Docker!
```
Stop and remove the containers
```
$ docker compose down
$ docker-compose down
```