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

@@ -3,6 +3,7 @@
## Node.js application with Nginx proxy and Redis database
Project structure:
```
.
├── README.md
@@ -19,7 +20,9 @@ Project structure:
```
[_compose.yaml_](compose.yaml)
```
redis:
image: 'redislabs/redismod'
@@ -45,36 +48,34 @@ redis:
- web1
- web2
```
The compose file defines an application with four services `redis`, `nginx`, `web1` and `web2`.
When deploying the application, docker compose maps port 80 of the nginx service container to port 80 of the host as specified in the file.
> **_INFO_**
> Redis runs on port 6379 by default. Make sure port 6379 on the host is not being used by another container, otherwise the port should be changed.
## Deploy with docker compose
```
$ docker compose up -d
$ docker-compose up -d
[+] Running 24/24
⠿ redis Pulled ...
⠿ 565225d89260 Pull complete
⠿ 565225d89260 Pull complete
[+] Building 2.4s (22/25)
=> [nginx-nodejs-redis_nginx internal] load build definition from Dockerfile ...
[+] Running 5/5
⠿ Network nginx-nodejs-redis_default Created
⠿ Container nginx-nodejs-redis-web2-1 Started
⠿ Container nginx-nodejs-redis-redis-1 Started
⠿ Container nginx-nodejs-redis-web1-1 Started
⠿ Network nginx-nodejs-redis_default Created
⠿ Container nginx-nodejs-redis-web2-1 Started
⠿ Container nginx-nodejs-redis-redis-1 Started
⠿ Container nginx-nodejs-redis-web1-1 Started
⠿ Container nginx-nodejs-redis-nginx-1 Started
```
## Expected result
Listing containers must show three containers running and the port mapping as below:
```
docker-compose ps
```
@@ -93,16 +94,14 @@ web1: Total number of visits is: 1
curl localhost:80
web1: Total number of visits is: 2
```
```
$ curl localhost:80
web2: Total number of visits is: 3
```
## Stop and remove the containers
```
$ docker compose down
$ docker-compose down
```