Flink Native Kubernetes實戰
阿新 • • 發佈:2020-11-18
Docker文件:
https://docs.docker.com/get-docker/
安裝Docker引擎
先決條件:
作業系統要求:要安裝Docker引擎,需要CentOS 7的維護版本。不支援或測試存檔版本。
必須啟用centos-extras儲存庫。預設情況下該儲存庫是啟用的,但是如果您已經禁用了它,則需要重新啟用它。
1.解除安裝舊版本
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
如果yum報告沒有安裝這些包,也是可以的。
/var/lib/docker/的內容,包括映象、容器、卷和網路。Docker引擎包現在稱為Docker -ce
2.安裝基礎包
yum install -y yum-utils
安裝 yum-utils 包(它提供 yum-config-manager 實用工具)並設定穩定儲存庫。
3.新增映象倉庫
預設國外源: yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo 阿里雲: yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum軟體包索引
yum makecache fast
5.安裝 Docker引擎
yum install docker-ce docker-ce-cli containerd.io
安裝特定版本的Docker:
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
6.啟動並加入開機自啟動
systemctl start docker
systemctl enable docker
判斷是否安裝成功:
[root@localhost ~]# docker version Client: Docker Engine - Community Version: **19.03.13** API version: 1.40 Go version: **go1.13.15** Git commit: 4484c46d9d Built: Wed Sep 16 17:03:45 2020 OS/Arch: linux/amd64 Experimental: false **Server: Docker Engine - Community** Engine: Version: 19.03.13 API version: 1.40 (minimum version 1.12) Go version: go1.13.15 Git commit: 4484c46d9d Built: Wed Sep 16 17:02:21 2020 OS/Arch: **linux/amd64** Experimental: false containerd: Version: 1.3.7 GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683 [root@localhost ~]#
7.測試hello-world
通過執行 hello-world 映象來驗證 Docker Engine 安裝是否正確。
docker run hello-world
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally #尋找映象
latest: Pulling from library/hello-world #從library遠端拉取hello-world映象
0e03bdcc26d7: Pull complete
Digest: sha256:8c5aeeb6a5f3ba4883347d3747a7249f491766ca1caa47e5da5dfcf6b9b717c0
Status: Downloaded newer image for hello-world:latest
Hello from Docker! #Docker安裝成功
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
8.檢視hello-world映象
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 9 months ago 13.3kB
[root@localhost ~]#
9.解除安裝 Docker 引擎
解除安裝 Docker Engine、 CLI 和 Containerd 軟體包:
yum remove docker-ce docker-ce-cli containerd.io
不會自動刪除主機上的映像、容器、卷或自定義配置檔案。您必須手動刪除任何已編輯的配置檔案。刪除所有映象,容器和卷:
rm -rf /var/lib/docker
配置阿里雲映象加速
1.找到映象加速器
2.配置映象加速器
針對Docker客戶端版本大於 1.10.0 的使用者
您可以通過修改daemon配置檔案/etc/docker/daemon.json來使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://gnxq79wc.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
回顧hello-world瞭解Docker執行原理
底層原理
1.Docker是怎麼工作的?
Docker是一個Client-Server結構的系統,Docker的守護程序執行在伺服器上。通過Socket客戶端訪問!