docker之DockerSwarm调整微服务及服务配置教程

Windows Windows 2个月前 (08-15) 16次浏览 未收录 0个评论 扫描二维码

修改微服务的配置

course-dubbo-service

sh

#!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/course-dubbo-service:latest .
docker push zhugeaming/course-dubbo-service:latest


>Dockerfile
``` bash
FROM java:openjdk-8
MAINTAINER liming www.idig8.com

COPY target/course-dubbo-service-1.0-SNAPSHOT.jar /course-dubbo-service.jar

ENTRYPOINT ["java","-jar","/course-dubbo-service.jar"]

course-edge-service

sh


#!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/course-edge-service:latest .
docker push zhugeaming/course-edge-service:latest

 >Dockerfile ``` bash FROM java:openjdk-8 MAINTAINER liming www.idig8.com COPY target/course-edge-service-1.0-SNAPSHOT.jar /course-edge-service.jar ENTRYPOINT ["java","-jar","/course-edge-service.jar"]

gataway-zuul

sh

 #!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/gataway-zuul:latest .
docker push zhugeaming/gataway-zuul:latest

 >Dockfile ``` bash FROM java:openjdk-8 MAINTAINER liming www.idig8.com COPY target/gataway-zuul-1.0-SNAPSHOT.jar /gataway-zuul.jar ENTRYPOINT ["java","-jar","/gataway-zuul.jar"]

user-edge-service

sh

#!/usr/bin/env bash source ~/.bash_profile mvn package docker build -f ./Dockerfile-hub -t zhugeaming/user-edge-service:latest . docker push zhugeaming/user-edge-service:latest

Dockerfile

#!/usr/bin/env bash source ~/.bash_profile mvn package docker build -f ./Dockerfile-hub -t zhugeaming/user-edge-service:latest . docker push zhugeaming/user-edge-service:latest

user-thrift-service

sh

#!/usr/bin/env bash source ~/.bash_profile mvn package docker build -f ./Dockerfile-hub -t zhugeaming/user-thrift-service:latest . docker push zhugeaming/user-thrift-service:latest

Dockerfile

 FROM java:openjdk-8 MAINTAINER liming www.idig8.com

COPY target/user-thrift-service-1.0-SNAPSHOT.jar /user-thrift-service.jar

ENTRYPOINT ["java","-jar","/user-thrift-service.jar"]

 * 编写yml文件 使用docker stack 进行批量生成 ``` yml version: "3.4" services: message-thrift-python-service: image: zhugeaming/message-thrift-python-service:latest deploy: endpoint_mode: dnsrr resources: limits: cpus: "0.2" memory: "128M" user-thrift-service: image: zhugeaming/user-thrift-service:latest deploy: endpoint_mode: dnsrr resources: limits: cpus: "0.2" memory: "512M" user-edge-service: image: zhugeaming/user-edge-service:latest deploy: endpoint_mode: vip resources: limits: cpus: "0.2" memory: "512M" ports: - "8082:8082" depends_on: - user-thrift-service - message-thrift-python-service course-dubbo-service: image: zhugeaming/user-edge-service:latest deploy: endpoint_mode: dnsrr resources: limits: cpus: "0.2" memory: "512M" depends_on: - user-thrift-service course-edge-service: image: zhugeaming/course-edge-service:latest deploy: endpoint_mode: vip resources: limits: cpus: "0.2" memory: "512M" ports: - "8081:8081" depends_on: - user-edge-service gateway-zuul: image: zhugeaming/gataway-zuul:latest deploy: endpoint_mode: vip resources: limits: cpus: "0.2" memory: "512M" ports: - "8080:8080" depends_on: - user-edge-service - course-edge-service networks: default: external: name: idig8-overlay

docker之DockerSwarm调整微服务及服务配置教程

docker stack 创建,因为机器内存太小,我还是使用的外网,下载镜像有点慢。

docker stack deploy -c ms-service.yml ms docker stack services ms 

docker之DockerSwarm调整微服务及服务配置教程

docker之DockerSwarm调整微服务及服务配置教程

PS:创建成功,下一步就是调试微服务。

docker之DockerSwarm调整微服务及服务配置教程

喜欢 (0)
[]
分享 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址