溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么進行RHEL7 Docker虛擬化使用

發(fā)布時間:2021-11-08 16:57:45 來源:億速云 閱讀:110 作者:柒染 欄目:建站服務器

本篇文章給大家分享的是有關怎么進行RHEL7 Docker虛擬化使用,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

Docker是一個開源工具,它可以讓創(chuàng)建和管理 linux容器變得簡單。容器就像是輕量級的虛擬機,作為一種新興的虛擬化方式,Docker跟傳統(tǒng)的虛擬化方式相比具有眾多優(yōu)勢。
  1. 環(huán)境: Centos7

  2. ip:172.16.1.10

  3. Docker version 1.13.1

怎么進行RHEL7 Docker虛擬化使用

安裝docker

[root@localhost ~]# yum install -y docker
已加載插件:fastestmirror, langpacks
base                                                                                                                                             | 3.6 kB  00:00:00     
extras                                                                                                                                           | 2.9 kB  00:00:00     
updates                                                                                                                                          | 2.9 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                                                      | 6.7 MB  00:00:08     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.neusoft.edu.cn
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 docker.x86_64.2.1.13.1-108.git4ef4b30.el7.centos 將被 安裝
--> 正在處理依賴關系 docker-common = 2:1.13.1-108.git4ef4b30.el7.centos,它被軟件包 2:docker-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 docker-client = 2:1.13.1-108.git4ef4b30.el7.centos,它被軟件包 2:docker-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 subscription-manager-rhsm-certificates,它被軟件包 2:docker-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在檢查事務
---> 軟件包 docker-client.x86_64.2.1.13.1-108.git4ef4b30.el7.centos 將被 安裝
---> 軟件包 docker-common.x86_64.2.1.13.1-108.git4ef4b30.el7.centos 將被 安裝
--> 正在處理依賴關系 skopeo-containers >= 1:0.1.26-2,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 oci-umount >= 2:2.3.3-3,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 oci-systemd-hook >= 1:0.1.4-9,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 oci-register-machine >= 1:0-5.13,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 container-storage-setup >= 0.9.0-1,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
--> 正在處理依賴關系 container-selinux >= 2:2.51-1,它被軟件包 2:docker-common-1.13.1-108.git4ef4b30.el7.centos.x86_64 需要
......
--> 正在處理依賴關系 policycoreutils = 2.5-17.1.el7,它被軟件包 policycoreutils-python-2.5-17.1.el7.x86_64 需要
---> 軟件包 policycoreutils.x86_64.0.2.5-33.el7 將被 更新
--> 正在處理依賴關系 libselinux-utils >= 2.5-14,它被軟件包 policycoreutils-2.5-33.el7.x86_64 需要
--> 正在檢查事務
---> 軟件包 libselinux.x86_64.0.2.5-11.el7 將被 升級
--> 正在處理依賴關系 libselinux(x86-64) = 2.5-11.el7,它被軟件包 libselinux-python-2.5-11.el7.x86_64 需要
---> 軟件包 libselinux.x86_64.0.2.5-14.1.el7 將被 更新
---> 軟件包 libselinux-utils.x86_64.0.2.5-11.el7 將被 升級
---> 軟件包 libselinux-utils.x86_64.0.2.5-14.1.el7 將被 更新
---> 軟件包 libsemanage-python.x86_64.0.2.5-8.el7 將被 升級
---> 軟件包 libsemanage-python.x86_64.0.2.5-14.el7 將被 更新
---> 軟件包 libsepol.x86_64.0.2.5-6.el7 將被 升級
---> 軟件包 libsepol.x86_64.0.2.5-10.el7 將被 更新
---> 軟件包 policycoreutils-python.x86_64.0.2.5-17.1.el7 將被 升級
---> 軟件包 policycoreutils-python.x86_64.0.2.5-33.el7 將被 更新
--> 正在處理依賴關系 setools-libs >= 3.3.8-4,它被軟件包 policycoreutils-python-2.5-33.el7.x86_64 需要
--> 正在檢查事務
---> 軟件包 libselinux-python.x86_64.0.2.5-11.el7 將被 升級
---> 軟件包 libselinux-python.x86_64.0.2.5-14.1.el7 將被 更新
---> 軟件包 setools-libs.x86_64.0.3.3.8-1.1.el7 將被 升級
---> 軟件包 setools-libs.x86_64.0.3.3.8-4.el7 將被 更新
--> 解決依賴關系完成
依賴關系解決
省略......
           
作為依賴被升級:
  libselinux.x86_64 0:2.5-14.1.el7                             libselinux-python.x86_64 0:2.5-14.1.el7             libselinux-utils.x86_64 0:2.5-14.1.el7             
  libsemanage.x86_64 0:2.5-14.el7                              libsemanage-python.x86_64 0:2.5-14.el7              libsepol.x86_64 0:2.5-10.el7                       
  policycoreutils.x86_64 0:2.5-33.el7                          policycoreutils-python.x86_64 0:2.5-33.el7          selinux-policy.noarch 0:3.13.1-252.el7_7.6         
  selinux-policy-targeted.noarch 0:3.13.1-252.el7_7.6          setools-libs.x86_64 0:3.3.8-4.el7                  
完畢!

啟動docker

[root@localhost ~]# systemctl start docker

設置開機自啟

[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

獲取鏡像

[root@localhost ~]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ... 
latest: Pulling from docker.io/library/centos
8a29a15cefae: Pull complete 
Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
Status: Downloaded newer image for docker.io/centos:latest

查看下載的鏡像

[root@localhost ~]# docker images centos
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/centos    latest              470671670cac        6 weeks ago         237 MB

查看docker狀態(tài)

[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since 一 2020-03-02 20:50:46 CST; 27min ago
     Docs: http://docs.docker.com
 Main PID: 24748 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─24748 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupd...
           └─24753 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-...
3月 02 20:50:43 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:43.911901519+08:00" level=info msg="libcontainerd: new containerd proce...: 24753"
3月 02 20:50:45 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:45.142091477+08:00" level=info msg="Graph migration to content-addressa...seconds"
3月 02 20:50:45 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:45.143284289+08:00" level=info msg="Loading containers: start."
3月 02 20:50:45 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:45.225796058+08:00" level=info msg="Firewalld running: true"
3月 02 20:50:45 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:45.954561065+08:00" level=info msg="Default bridge (docker0) is assigne...address"
3月 02 20:50:46 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:46.527870909+08:00" level=info msg="Loading containers: done."
3月 02 20:50:46 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:46.629201628+08:00" level=info msg="Daemon has completed initialization"
3月 02 20:50:46 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:46.629229137+08:00" level=info msg="Docker daemon" commit="4ef4b30/1.13...n=1.13.1
3月 02 20:50:46 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
3月 02 20:50:46 localhost.localdomain dockerd-current[24748]: time="2020-03-02T20:50:46.642881482+08:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.

以上就是怎么進行RHEL7 Docker虛擬化使用,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI