美文网首页
使用Spring Cloud和Docker构建微服务

使用Spring Cloud和Docker构建微服务

作者: 新强吖 | 来源:发表于2016-09-22 18:22 被阅读5975次

作为了解springcloud中各个组件怎么使用,个人感觉这个项目spring-cloud-microservice-example是最好的,在经过两天捣鼓之后,终于跑起来了,现在记录一下:
中文翻译文章地址:http://www.dockone.io/article/510

碰到的问题:
1 在构建项目的时候,执行mvn clean install会报错,如下:
Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default) on project users-microservice: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused -> [Help 1]

解决方案:在安装好docker的机器上执行如下命令
DOCKER_HOST=unix:///var/run/docker.sock mvn clean install
即可

2 首先你要对docker安装部署都熟悉,这里面也碰到很多问题,在按照文中链接仔细执行久OK。

3 怎么运行? 通过git导入eclipse后,因为自己的机器时mac,进入项目中docker目录,执行 docker-compose up后,会显示如下:

Paste_Image.png

在浏览器上运行


Paste_Image.png

相关文章

网友评论

      本文标题:使用Spring Cloud和Docker构建微服务

      本文链接:https://www.haomeiwen.com/subject/xhwzettx.html