我试图在Linux上安装docker详情如下 -
Mint version 19,
Code name : Tara,
PackageBase : Ubuntu Bionic
Cinnamon (64-bit)
Run Code Online (Sandbox Code Playgroud)
参考链接:https://docs.docker.com/install/linux/docker-ce/ubuntu/
脚步:
1. sudo apt-get remove docker docker-engine docker.io
2. sudo apt-get update
3. sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
4. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5. sudo apt-key fingerprint 0EBFCD88
6. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
7. sudo apt-get update
8. sudo apt-get install docker-ce
Run Code Online (Sandbox Code Playgroud)
对于第6步,我检查了lsb_release -cs
xxxxxxxxx:~$ lsb_release -cs
tara
Run Code Online (Sandbox Code Playgroud)
我在第7步看到了问题. …
我使用 Java8 和 SpringBoot 使用 Maven 创建了一个微服务。让我们称之为 MicroServiceA
它具有返回 ResponseEntity 对象的控制器,如下所示:
@RestController
@RequestMapping("/api")
public class MicroserviceAController {
@GetMapping(value = "/all")
public ResponseEntity<ServiceAResponseWrapper<List<ServiceADto>>> getAll() {
ServiceAResponseWrapper<List<ServiceADto>> wrapper =
new ServiceAResponseWrapper<List<ServiceADto>>(ServiceAResponseStatus.SUCCESS,findAll());
return new ResponseEntity<ServiceAResponseWrapper<List<ServiceADto>>>(wrapper,HttpStatus.OK);
}
public static List<ServiceADto> findAll() {
//returns list of ServiceADto objects
}
}
Run Code Online (Sandbox Code Playgroud)
当我启动此服务并在任何浏览器中验证它时:http://localhost:8073/api/all/,我得到显示的 JSON 响应。
现在,如果我想将我的服务引入 EUREKA 服务注册中心,那么我需要进行以下更改。
转到 pom.xml 并添加依赖项
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
转到 application.yml 并添加以下内容:
eureka:
client:
registerWithEureka: true …
Run Code Online (Sandbox Code Playgroud)