[TOC]
# 1. 安裝Docker
**1. 卸載舊版本**
```shell
yum list installed | grep docker
yum -y remove docker的包名稱
--刪除docker的所有鏡像和容器
rm -rf /var/lib/docker
```
**2. 安裝必要的軟件包**
```shell
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
```
**3. 設置下載的鏡像倉庫**
```shell
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
```
**4. 列出有哪些docker版本**
```shell
# yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
```
**5. 安裝指定版本(這里使用18.06.3.ce-3.el7版本)**
```shell
yum install docker-ce-18.06.3.ce
```
**6. 查看版本**
```shell
# docker -v
Docker version 18.06.3-ce, build d7080c1
```
**7. 啟動Docker**
```shell
# systemctl start docker
# systemctl enable docker
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running)
```
**8. 添加阿里云鏡像下載地址**
```shell
# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://zydiol88.mirror.aliyuncs.com"]
}
```
**9. 重啟Docker**
```shell
# systemctl restart docker
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running)
```
<br/>
# 2. 使用Dockerfile制作微服務鏡像
下面演示利用Dockerfile制作一個Eureka注冊中心的鏡像。
<br/>
**1. 上傳 tensquare-eureka-server-1.0-SNAPSHOT.jar 包到 production-server 機器上**
**2. 編寫`Dockerfile`文件**
```dockerfile
# vim Dockerfile
FROM openjdk:8-jdk-alpine
ARG JAR_FILE
COPY ${JAR_FILE} /target/tensquare-eureka-server-1.0-SNAPSHOT.jar
EXPOSE 10086
ENTRYPOINT ["java","-jar","/target/tensquare-eureka-server-1.0-SNAPSHOT.jar"]
```
**3. 構建鏡像**
```shell
docker build --build-arg JAR_FILE=tensquare-eureka-server-1.0-SNAPSHOT.jar -t tensquare-eureka-server:v1.0 .
```
**4. 查看鏡像是否構建成功**
```shell
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tensquare-eureka-server v1.0 70b977ee0289 35 seconds ago 150MB
```
**5. 創建容器**
```shell
docker run -i --name=tensquare-eureka-server -p 10086:10086 tensquare-eureka-server:v1.0
```
**6. 瀏覽器訪問容器:http://192.168.1.30:10086/**
- 相關概念
- 軟件開發生命周期
- 軟件開發瀑布模型
- 軟件的敏捷開發
- 持續集成
- Jenkins介紹
- Jenkins是什么
- Jenkins的特征
- Jenkins環境搭建
- 搭建架構說明
- Gitlab安裝與配置
- Jenkins安裝與配置
- Tomcat安裝和配置
- Jenkins構建項目
- 自由風格軟件項目構建
- Maven項目構建
- Pipeline流水線項目構建
- Pipeline是什么
- Pipeline語法
- 流水線項目構建演示
- Pipeline Script from SCM
- 構建觸發器
- 觸發遠程構建
- 其他工程構建后觸發
- 定時構建
- 輪詢SCM
- Git hook自動觸發構建
- 參數化構建
- 配置郵箱發送構建結果
- SonarQube代碼審查平臺
- SonarQube是什么
- SonarQube平臺搭建
- 安裝jdk11
- 安裝數據庫PostgreSQL12
- 安裝SonarQube
- SonarQube實現代碼審查
- Jenkins+Docker+SpringCloud(1)
- 流程說明
- 環境搭建
- 服務器列表
- Docker安裝與配置
- Harbor安裝與配置
- Nginx安裝與配置
- 微服務持續集成演示
- Jenkins上配置
- 微服務項目配置
- 部署前端靜態web網站