http://www.runoob.com/docker/centos-docker-install.html

CentOS Docker 安裝
Docker支持以下的CentOS版本:
CentOS 7 (64-bit)
CentOS 6.5 (64-bit) 或更高的版本

前提條件
目前,CentOS 僅發行版本中的內核支持 Docker。
Docker 運行在 CentOS 7 上,要求系統為64位、系統內核版本為 3.10 以上。
Docker 運行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系統為64位、系統內核版本為 2.6.32-431 或者更高版本。

使用 yum 安裝(CentOS 7下)
Docker 要求 CentOS 系統的內核版本高于 3.10 ,查看本頁面的前提條件來驗證你的CentOS 版本是否支持 Docker 。
通過 uname -r 命令查看你當前的內核版本

[root@huixuan ~]# uname -a 
Linux huixuan 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@huixuan ~]# 

安裝 Docker
Docker 軟件包和依賴包已經包含在默認的 CentOS-Extras 軟件源里,安裝命令如下:

啟動 Docker 后臺服務
service docker start

之后需要修改:Docker0網橋默認網段
[root@huixuan ~]# ps -ef | grep docker
root      3691     1  0 17:28 ?        00:00:00 /usr/bin/dockerd-current –add-runtime docker-runc=/usr/libexec/docker/docker-runc-current –default-runtime=docker-runc –exec-opt native.cgroupdriver=systemd –userland-proxy-path=/usr/libexec/docker/docker-proxy-current –seccomp-profile=/etc/docker/seccomp.json –selinux-enabled –log-driver=journald –signature-verification=false –storage-driver overlay2
root      3698  3691  0 17:28 ?        00:00:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock –metrics-interval=0 –start-timeout 2m –state-dir /var/run/docker/libcontainerd/containerd –shim docker-containerd-shim –runtime docker-runc –runtime-args –systemd-cgroup=true
root      3838  3817  0 17:30 pts/0    00:00:00 grep –color=auto docker
[root@huixuan ~]# 

測試運行 hello-world
[root@huixuan ~]# docker run hello-world
Unable to find image \\\’hello-world:latest\\\’ locally
Trying to pull repository docker.io/library/hello-world … 
latest: Pulling from docker.io/library/hello-world
9bb5a5d4561a: Pull complete 
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for docker.io/hello-world:latest

Hello from 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/engine/userguide/

[root@huixuan ~]# 

使用腳本安裝 Docker
1、使用 sudo 或 root 權限登錄 Centos。
2、確保 yum 包更新到最新。
yum update

3、執行 Docker 安裝腳本。
[root@huixuan ~]# curl -fsSL https://get.docker.com/ | sh
# Executing docker install script, commit: 36b78b2
Warning: the docker command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we\\\’re displaying this warning and provide the opportunity to cancel the
installation.

執行這個腳本會添加 docker.repo 源并安裝 Docker。

4、啟動 Docker 進程。
[root@huixuan ~]# service docker start 
Redirecting to /bin/systemctl start docker.service

5、驗證 docker 是否安裝成功并在容器中執行一個測試的鏡像。
[root@huixuan ~]# docker run hello-world

Hello from 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/engine/userguide/

[root@huixuan ~]# 

到此,docker 在 CentOS 系統的安裝完成。

鏡像加速
鑒于國內網絡問題,后續拉取 Docker 鏡像十分緩慢,我們可以需要配置加速器來解決,我使用的是網易的鏡像地址:http://hub-mirror.c.163.com。
新版的 Docker 使用 /etc/docker/daemon.json(Linux) 或者 %programdata%\\\\docker\\\\config\\\\daemon.json(Windows) 來配置 Daemon。
請在該配置文件中加入(沒有該文件的話,請先建一個):

[root@huixuan ~]# cat /etc/docker/daemon.json 
{
  registry-mirrors: [http://hub-mirror.c.163.com]
  bip:192.168.100.1/24
}
[root@huixuan ~]# 

更多關于云服務器域名注冊,虛擬主機的問題,請訪問三五互聯官網:m.shinetop.cn

贊(0)
聲明:本網站發布的內容(圖片、視頻和文字)以原創、轉載和分享網絡內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。郵箱:3140448839@qq.com。本站原創內容未經允許不得轉載,或轉載時需注明出處:三五互聯知識庫 » docker學習1:CentOS Docker 安裝

登錄

找回密碼

注冊

主站蜘蛛池模板: 九九热在线免费视频观看| 90后极品粉嫩小泬20p| 日本亚洲一区二区精品| 日韩av一区二区三区不卡| 国产精品中文一区二区| 夜爽8888视频在线观看| 重口SM一区二区三区视频| 千阳县| 熟女少妇精品一区二区| 另类专区一区二区三区| 艳妇乳肉豪妇荡乳在线观看| 日韩一区二区大尺度在线| 大陆熟妇丰满多毛xxxⅹ| 亚洲熟女一区二区av| 成人免费乱码大片a毛片| 亚洲情A成黄在线观看动漫尤物 | 嫩草成人AV影院在线观看| 国产午夜福利视频合集| 国产不卡精品视频男人的天堂| 西西午夜无码大胆啪啪国模| 日韩中文字幕免费在线观看| 无码国模国产在线观看免费 | 国产自产视频一区二区三区| 日本免费一区二区三区最新vr| 国产一区二区不卡视频在线| 亚洲综合无码一区二区| 久久99久久99精品免视看国产成人| 日韩亚洲精品中文字幕| 国产亚洲精品久久久久秋霞| 色噜噜亚洲男人的天堂| 亚洲AV无码一二区三区在线播放| 一区二区福利在线视频| 欧洲熟妇色xxxxx欧美| 开心色怡人综合网站| 亚洲成人av一区免费看| 欧美情侣性视频| 久99久热免费视频播放| 久久这里有精品国产电影网| 最新国产AV最新国产在钱| 色哟哟www网站入口成人学校| 上司人妻互换中文字幕|