https://github.com/catcherwong/nacosdockersample
https://github.com/catcherwong/nacosdockersample
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/catcherwong/nacosdockersample
- Owner: catcherwong
- License: apache-2.0
- Created: 2020-08-29T16:19:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T14:54:08.000Z (about 3 years ago)
- Last Synced: 2025-01-26T00:17:16.638Z (4 months ago)
- Language: C#
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NacosDockerSample
This repo contain some samples about running in docker using nacos-sdk-csharp.
## Service Registration and Service Discovery
### 1. Clone project
```sh
git clone --depth 1 https://github.com/catcherwong/NacosDockerSample.git
cd NacosDockerSample
```### 2. Modify the configuration
Modify the `appsettings.json` file of App1 and App2.
```JSON
{
"nacos": {
"ServerAddresses": [ "replace with your nacos server address" ],
"DefaultTimeOut": 15000,
"Namespace": "replace with your namespace",
"ListenInterval": 1000,
"ServiceName": "replace with your servicename"
}
}
```### 3. Build docker images
```sh
docker build -t app1:v1 -f .\docker\Dockerfile.App1 .
docker build -t app2:v1 -f .\docker\Dockerfile.App2 .
```### 4. Run up samples
```
docker run --name=app1 -d -p 9512:80 app1:v1
docker run --name=app11 -d -p 9516:80 app1:v1
docker run --name=app2 -d -p 9513:80 app2:v1
```### 5. Enjoy it
```sh
curl localhost:9512/api/values/test
["value1","value2","App2222222222222222222222222"]curl localhost:9513/api/values/test
["value1","value2","App1"]curl localhost:9516/api/values/test
["value1","value2","App2222222222222222222222222"]
```