docs: update docs of README.mds.
summary: update command docker compose to docker-compose.
This commit is contained in:
@@ -9,6 +9,7 @@ You can open this sample in the Dev Environments feature of Docker Desktop versi
|
||||
### React application with a NodeJS backend and a MySQL database
|
||||
|
||||
Project structure:
|
||||
|
||||
```
|
||||
.
|
||||
├── backend
|
||||
@@ -24,6 +25,7 @@ Project structure:
|
||||
```
|
||||
|
||||
[_compose.yaml_](compose.yaml)
|
||||
|
||||
```
|
||||
services:
|
||||
backend:
|
||||
@@ -45,19 +47,20 @@ services:
|
||||
- 3000:3000
|
||||
...
|
||||
```
|
||||
|
||||
The compose file defines an application with three services `frontend`, `backend` and `db`.
|
||||
When deploying the application, docker compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file.
|
||||
Make sure port 3000 on the host is not already being in use.
|
||||
|
||||
> ℹ️ **_INFO_**
|
||||
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
|
||||
> You still can use the MySQL image by uncommenting the following line in the Compose file
|
||||
> You still can use the MySQL image by uncommenting the following line in the Compose file
|
||||
> `#image: mysql:8.0.27`
|
||||
|
||||
## Deploy with docker compose
|
||||
|
||||
```
|
||||
$ docker compose up -d
|
||||
$ docker-compose up -d
|
||||
Creating network "react-express-mysql_default" with the default driver
|
||||
Building backend
|
||||
Step 1/16 : FROM node:10
|
||||
@@ -73,6 +76,7 @@ Creating react-express-mysql_frontend_1 ... done
|
||||
## Expected result
|
||||
|
||||
Listing containers must show containers running and the port mapping as below:
|
||||
|
||||
```
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
@@ -85,16 +89,17 @@ After the application starts, navigate to `http://localhost:3000` in your web br
|
||||
|
||||

|
||||
|
||||
|
||||
The backend service container has the port 80 mapped to 80 on the host.
|
||||
|
||||
```
|
||||
$ curl localhost:80
|
||||
{"message":"Hello from MySQL 8.0.19"}
|
||||
```
|
||||
|
||||
Stop and remove the containers
|
||||
|
||||
```
|
||||
$ docker compose down
|
||||
$ docker-compose down
|
||||
Stopping react-express-mysql_frontend_1 ... done
|
||||
Stopping react-express-mysql_backend_1 ... done
|
||||
Stopping react-express-mysql_db_1 ... done
|
||||
|
Reference in New Issue
Block a user