Get Started with Docker in RHEL7
本文将呈现在RHEL7中,如何通过官方介质包部署Docker。
正如这里所说的“官方”,因此,本文需要你具有红帽RHN的可用账号,而该账号的激活是付费的。
本文参考官方文档:https://access.redhat.com/articles/881893
官方文档的原文为英文版,且付费用户方可访问。
在本文开始前,你需要有一台装好了的RHEL7操作系统。
下面开始正式描述。
1.注册到RHN。
由于本文安装Docker的介质包将从红帽RHN官方获取。
所以,在开始正式部署前,你需要做的第一件事情便是注册当前RHEL。
在RHEL7中,注册RHN的工具为:subscription-manager。
在你刚刚安装完操作系统的时候,初始化系统的阶段,红帽也会要求你登陆RHN,并激活。你可以在那个时候就注册RHN,或者你可以选择稍后进行。
subscription-manager可以以两种方式运行:
图形化:
如图所示,你看到的是我已经成功注册RHN的系统状态。
在还没有注册RHN之前,你是看不到“My Subscriptions”的选项卡的。
命令行:
命令行部分主要是通过“subscription-manager”完成。
该命令的“–help”选项,可以查看到该命令的详细使用指南:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[root@DockerServer ~]# subscription-manager --help Usage: subscription-manager MODULE-NAME [MODULE-OPTIONS] [--help] Primary Modules: attach Attach a specified subscription to the registered system list List subscription and product information for this system refresh Pull the latest subscription data from the server register Register this system to the Customer Portal or another subscription management service release Configure which operating system release to use remove Remove all or specific subscriptions from this system status Show status information for this system's subscriptions and products unregister Unregister this system from the Customer Portal or another subscription management service Other Modules: auto-attach Set if subscriptions are attached on a schedule (default of daily) clean Remove all local system and subscription data without affecting the server config List, set, or remove the configuration parameters in use by this system environments Display the environments available for a user facts View or update the detected system information identity Display the identity certificate for this system or request a new one import Import certificates which were provided outside of the tool orgs Display the organizations against which a user can register a system plugins View and configure subscription-manager plugins redeem Attempt to redeem a subscription for a preconfigured system repo-override Manage custom content repository settings repos List the repositories which this system is entitled to use service-level Manage service levels for this system subscribe Deprecated, see attach unsubscribe Deprecated, see remove version Print version information [root@DockerServer ~]# |
在这里,我们首先要注册RHN:
1 2 3 |
[root@DockerServer ~]# subscription-manager register --username=********@********.com --password=******* The system has been registered with ID: 1c24****-a*0e-4***-9***-c********955 [root@DockerServer ~]# |
如上命令所示,
“–username”部分为你的RHN账户的Email。
“–password”部分为你的RHN账户的口令。
登陆成功后,你会得到如上命令所示的反馈信息:“The system has been registered with ID:…”
然后,你就可以通过“list”查看你的RHN当前可以订阅的所有频道的信息了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
[root@DockerServer ~]# subscription-manager list --available +-------------------------------------------+ Available Subscriptions +-------------------------------------------+ Subscription Name: High-Availability (1-2 sockets) Provides: Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1145289RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5849724e Available: 6 Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: High-Availability (1-2 sockets) Provides: Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1145289RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f58617260 Available: Unlimited Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: High-Availability (4 sockets) Provides: Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1173900RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f554571c5 Available: 6 Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: High-Availability (4 sockets) Provides: Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1173900RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f555871d7 Available: Unlimited Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Red Hat Enterprise Linux Server, Premium (1-2 sockets) (Unlimited guests) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0197329RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5b7c7313 Available: Unlimited Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Red Hat Enterprise Linux Server, Premium (1-2 sockets) (Unlimited guests) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0197329RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5b5c72fd Available: 5 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: Red Hat Enterprise Linux Server, Premium (4 sockets) (Unlimited guests) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0133325RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5a6572cd Available: 12 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: Red Hat Enterprise Linux Server, Premium (1-2 sockets) (Up to 1 guest) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0155783RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f562a7204 Available: 30 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Red Hat Enterprise Linux Server, Premium (4 sockets) (Unlimited guests) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0133325RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5a7b72e3 Available: Unlimited Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Resilient Storage (1-2 sockets) Provides: Red Hat Enterprise Linux Resilient Storage (for RHEL Server) Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1387643RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f599a72a2 Available: 4 Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: Resilient Storage (4 sockets) Provides: Red Hat Enterprise Linux Resilient Storage (for RHEL Server) Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1367869RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f5905728a Available: Unlimited Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Resilient Storage (1-2 sockets) Provides: Red Hat Enterprise Linux Resilient Storage (for RHEL Server) Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1387643RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f59af72b5 Available: Unlimited Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Resilient Storage (4 sockets) Provides: Red Hat Enterprise Linux Resilient Storage (for RHEL Server) Red Hat Enterprise Linux High Availability (for RHEL Server) SKU: RH1367869RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f58eb7277 Available: 4 Suggested: 1 Service Level: Layered Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: Red Hat Enterprise Linux Server, Premium (4 sockets) (Up to 1 guest) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0165545RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f56fd7234 Available: 5 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Virtual Subscription Name: Red Hat Enterprise Linux Server, Premium (1-2 sockets) (Up to 1 guest) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0155783RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f561371ee Available: 30 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical Subscription Name: Red Hat Enterprise Linux Server, Premium (4 sockets) (Up to 1 guest) Provides: Red Hat Beta Oracle Java (for RHEL Server) Red Hat Enterprise Linux Server Red Hat Software Collections Beta (for RHEL Server) SKU: RH0165545RN Contract: 10332897 Pool ID: 8a85f98349eee31e0149fa6f56e3721e Available: 5 Suggested: 1 Service Level: PREMIUM Service Type: L1-L3 Subscription Type: Standard Ends: 11/29/2015 System Type: Physical [root@DockerServer ~]# |
你可以通过命令:
subscription-manager attach –pool=
如果你不知道Attach哪一个,你可以使用“–auto”选项,即:
subscription-manager attach –auto
如果你没有Attach任何POOL,那么稍后的YUM源的选择会为空:
1 2 3 |
[root@DockerServer ~]# subscription-manager repos --list This system has no repositories available through subscriptions. [root@DockerServer ~]# |
然后你可以通过:
subscription-manager repos –enable=
来启用目标订阅中的YUM源。
其中,repo_name,你可以通过以下命令获取完整的列表:
subscription-manager repos –list
在本文所要安装的Docker的场景中,我们在该部分做出如下的修改:
1. auto-attach
1 2 3 4 5 6 |
[root@DockerServer ~]# subscription-manager attach --auto Installed Product Current Status: Product Name: Red Hat Enterprise Linux Server Status: Subscribed [root@DockerServer ~]# |
2. 查看该订阅中有哪些YUM源:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
[root@DockerServer ~]# subscription-manager repos --list +----------------------------------------------------------+ Available Repositories in /etc/yum.repos.d/redhat.repo +----------------------------------------------------------+ Repo ID: rhel-7-server-optional-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/optional/debug Enabled: 0 Repo ID: rhel-7-server-rhn-tools-beta-debug-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server Beta (Debug RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhn-tools /debug Enabled: 0 Repo ID: rhel-7-server-v2vwin-1-debug-rpms Repo Name: Red Hat Virt V2V Tool for RHEL 7 (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/v2vwin/debug Enabled: 0 Repo ID: rhel-7-server-rhn-tools-debug-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rhn-tools/debug Enabled: 0 Repo ID: rhel-server-rhscl-7-beta-rpms Repo Name: Red Hat Software Collections Beta RPMs for Red Hat Enterprise Linux 7 Server Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhscl/1/o s Enabled: 0 Repo ID: rhel-7-server-beta-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/source/SR PMS Enabled: 0 Repo ID: rhel-7-server-optional-fastrack-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Fastrack (Debug RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/optio nal/debug Enabled: 0 Repo ID: rhel-7-server-extras-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Extras (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/e xtras/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-v2vwin-1-rpms Repo Name: Red Hat Virt V2V Tool for RHEL 7 (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/v2vwin/os Enabled: 0 Repo ID: rhel-7-server-rpms Repo Name: Red Hat Enterprise Linux 7 Server (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/os Enabled: 1 Repo ID: rhel-7-server-beta-rpms Repo Name: Red Hat Enterprise Linux 7 Server Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/os Enabled: 0 Repo ID: rhel-7-server-extras-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Extras (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/e xtras/os Enabled: 0 Repo ID: rhel-7-server-rh-common-beta-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common Beta (Debug RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rh-common /debug Enabled: 0 Repo ID: rhel-7-server-supplementary-beta-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary Beta (Debug RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/supplemen tary/debug Enabled: 0 Repo ID: rhel-7-server-rhn-tools-beta-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhn-tools /os Enabled: 0 Repo ID: rhel-7-server-rh-common-beta-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rh-common /os Enabled: 0 Repo ID: rhel-7-server-supplementary-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/supplementary/debug Enabled: 0 Repo ID: rhel-server-rhscl-7-beta-source-rpms Repo Name: Red Hat Software Collections Beta Source RPMs for Red Hat Enterprise Linux 7 Server Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhscl/1/s ource/SRPMS Enabled: 0 Repo ID: rhel-7-server-rhn-tools-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rhn-tools/os Enabled: 0 Repo ID: rhel-server-rhscl-7-beta-debug-rpms Repo Name: Red Hat Software Collections Beta Debug RPMs for Red Hat Enterprise Linux 7 Server Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhscl/1/d ebug Enabled: 0 Repo ID: rhel-7-server-extras-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Extras (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/e xtras/debug Enabled: 0 Repo ID: rhel-7-server-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/debug Enabled: 0 Repo ID: rhel-7-server-thirdparty-oracle-java-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/oracle-java/os Enabled: 0 Repo ID: rhel-7-server-fastrack-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Fastrack (RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/os Enabled: 0 Repo ID: rhel-7-server-optional-beta-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Beta (Debug RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/optional/ debug Enabled: 0 Repo ID: rhel-7-server-rh-common-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rh-common/os Enabled: 0 Repo ID: rhel-7-server-thirdparty-oracle-java-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/oracle-java/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-optional-fastrack-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Fastrack (RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/optio nal/os Enabled: 0 Repo ID: rhel-7-server-thirdparty-oracle-java-beta-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/oracle-ja va/os Enabled: 0 Repo ID: rhel-7-server-rh-common-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common (Debug RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rh-common/debug Enabled: 0 Repo ID: rhel-7-server-supplementary-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/supplementary/os Enabled: 0 Repo ID: rhel-7-server-rhn-tools-beta-source-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rhn-tools /source/SRPMS Enabled: 0 Repo ID: rhel-7-server-v2vwin-1-source-rpms Repo Name: Red Hat Virt V2V Tool for RHEL 7 (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/v2vwin/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-optional-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional (RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/optional/os Enabled: 0 Repo ID: rhel-7-server-rh-common-beta-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rh-common /source/SRPMS Enabled: 0 Repo ID: rhel-7-server-fastrack-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Fastrack (Source RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/sourc e/SRPMS Enabled: 0 Repo ID: rhel-7-server-supplementary-beta-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/supplemen tary/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-supplementary-beta-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/supplemen tary/os Enabled: 0 Repo ID: rhel-7-server-optional-beta-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/optional/ source/SRPMS Enabled: 0 Repo ID: rhel-7-server-optional-fastrack-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Fastrack (Source RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/optio nal/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-rhn-tools-source-rpms Repo Name: RHN Tools for Red Hat Enterprise Linux 7 Server (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rhn-tools/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-fastrack-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Fastrack (Debug RPMs) Repo URL: https://cdn.redhat.com/content/fastrack/rhel/server/7/$basearch/debug Enabled: 0 Repo ID: rhel-7-server-rh-common-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - RH Common (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/rh-common/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-supplementary-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Supplementary (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/supplementary/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-thirdparty-oracle-java-beta-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Oracle Java Beta (Source RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/oracle-ja va/source/SRPMS Enabled: 0 Repo ID: rhel-7-server-beta-debug-rpms Repo Name: Red Hat Enterprise Linux 7 Server Beta (Debug RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/debug Enabled: 0 Repo ID: rhel-7-server-optional-beta-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional Beta (RPMs) Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/optional/ os Enabled: 0 Repo ID: rhel-7-server-optional-source-rpms Repo Name: Red Hat Enterprise Linux 7 Server - Optional (Source RPMs) Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basear ch/optional/source/SRPMS Enabled: 0 [root@DockerServer ~]# |
3. 启用其中的两个YUM源:rhel-7-server-extras-rpms与rhel-7-server-optional-rpms
1 2 3 4 5 |
[root@DockerServer ~]# subscription-manager repos --enable=rhel-7-server-extras-rpms Repo 'rhel-7-server-extras-rpms' is enabled for this system. [root@DockerServer ~]# subscription-manager repos --enable=rhel-7-server-optional-rpms Repo 'rhel-7-server-optional-rpms' is enabled for this system. [root@DockerServer ~]# |
这时候,你通过YUM,可以看到当前启用的YUM源:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@DockerServer ~]# yum repolist Loaded plugins: langpacks, product-id, subscription-manager rhel-7-server-optional-rpms | 2.9 kB 00:00:00 rhel-7-server-rpms | 3.7 kB 00:00:00 (1/2): rhel-7-server-optional-rpms/7Server/x86_64/primary_db | 1.8 MB 00:00:14 (2/2): rhel-7-server-rpms/7Server/x86_64/primary_db | 9.0 MB 00:00:57 (1/3): rhel-7-server-rpms/7Server/x86_64/updateinfo | 148 kB 00:00:04 (2/3): rhel-7-server-optional-rpms/7Server/x86_64/updateinfo | 111 kB 00:00:04 (3/3): rhel-7-server-rpms/7Server/x86_64/group_gz | 133 kB 00:00:04 repo id repo name status rhel-7-server-optional-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server - Optional (RPMs) 4,568 rhel-7-server-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server (RPMs) 5,201 repolist: 9,769 [root@DockerServer ~]# |
这时候,你可以看到每个YUM源中的软件包的数量。
上面的命令中,由于“repolist”之前,本地没有YUM源的METADATA信息,所以,在“repolist”之前,YUM自动执行了“yum makecache”。
“yum makecache”的数据会被记录在YUM配置文件中定义的“cachedir”中,如果该配置文件的该目录位置变了,YUM会重新MAKECACHE。
YUM配置文件:/etc/yum.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[root@DockerServer ~]# cat /etc/yum.conf [main] #cachedir=/var/cache/yum/$basearch/$releasever cachedir=/software/yum/$basearch/$releasever keepcache=1 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=3 # This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d [root@DockerServer ~]# |
按照我的习惯,我会开启YUM的本地包缓存。
安装DOCKER。
通过“yum”安装Docker的时候,需要选择两个软件包:docker和docker-registry
如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
[root@DockerServer ~]# yum list | grep docker docker.x86_64 1.3.2-4.el7 rhel-7-server-extras-rpms docker-registry.noarch 0.6.8-8.el7 rhel-7-server-extras-rpms [root@DockerServer ~]# [root@DockerServer ~]# yum install docker docker-registry Loaded plugins: langpacks, product-id, subscription-manager rhel-7-server-extras-rpms | 2.9 kB 00:00:00 rhel-7-server-optional-rpms | 2.9 kB 00:00:00 rhel-7-server-rpms | 3.7 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package docker.x86_64 0:1.3.2-4.el7 will be installed --> Processing Dependency: systemd-units >= 208-11.el7_0.5 for package: docker-1.3.2-4.el7.x86_64 ---> Package docker-registry.noarch 0:0.6.8-8.el7 will be installed --> Processing Dependency: python-requests for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-jinja2 for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-gunicorn for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-gevent for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-flask for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-blinker for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: python-backports-lzma for package: docker-registry-0.6.8-8.el7.noarch --> Processing Dependency: PyYAML for package: docker-registry-0.6.8-8.el7.noarch --> Running transaction check ---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed --> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64 ---> Package python-backports-lzma.x86_64 0:0.0.2-7.el7 will be installed ---> Package python-blinker.noarch 0:1.3-2.el7 will be installed ---> Package python-flask.noarch 1:0.10.1-4.el7 will be installed --> Processing Dependency: python-werkzeug for package: 1:python-flask-0.10.1-4.el7.noarch --> Processing Dependency: python-itsdangerous for package: 1:python-flask-0.10.1-4.el7.noarch ---> Package python-gevent.x86_64 0:1.0-2.el7 will be installed --> Processing Dependency: python-greenlet for package: python-gevent-1.0-2.el7.x86_64 --> Processing Dependency: libev.so.4()(64bit) for package: python-gevent-1.0-2.el7.x86_64 --> Processing Dependency: libcares.so.2()(64bit) for package: python-gevent-1.0-2.el7.x86_64 ---> Package python-gunicorn.noarch 0:18.0-2.el7 will be installed ---> Package python-jinja2.noarch 0:2.7.2-2.el7 will be installed --> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-2.el7.noarch --> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-2.el7.noarch ---> Package python-requests.noarch 0:1.1.0-8.el7 will be installed --> Processing Dependency: python-urllib3 for package: python-requests-1.1.0-8.el7.noarch ---> Package systemd.x86_64 0:208-11.el7 will be updated --> Processing Dependency: systemd = 208-11.el7 for package: systemd-python-208-11.el7.x86_64 --> Processing Dependency: systemd = 208-11.el7 for package: libgudev1-208-11.el7.x86_64 --> Processing Dependency: systemd = 208-11.el7 for package: systemd-sysv-208-11.el7.x86_64 ---> Package systemd.x86_64 0:208-11.el7_0.5 will be an update --> Processing Dependency: systemd-libs = 208-11.el7_0.5 for package: systemd-208-11.el7_0.5.x86_64 --> Running transaction check ---> Package c-ares.x86_64 0:1.10.0-3.el7 will be installed ---> Package libev.x86_64 0:4.15-4.el7 will be installed ---> Package libgudev1.x86_64 0:208-11.el7 will be updated ---> Package libgudev1.x86_64 0:208-11.el7_0.5 will be an update ---> Package libyaml.x86_64 0:0.1.4-10.el7 will be installed ---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed ---> Package python-greenlet.x86_64 0:0.4.2-3.el7 will be installed ---> Package python-itsdangerous.noarch 0:0.23-2.el7 will be installed ---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed ---> Package python-urllib3.noarch 0:1.5-8.el7 will be installed --> Processing Dependency: python-six for package: python-urllib3-1.5-8.el7.noarch ---> Package python-werkzeug.noarch 0:0.9.1-2.el7 will be installed ---> Package systemd-libs.x86_64 0:208-11.el7 will be updated ---> Package systemd-libs.x86_64 0:208-11.el7_0.5 will be an update ---> Package systemd-python.x86_64 0:208-11.el7 will be updated ---> Package systemd-python.x86_64 0:208-11.el7_0.5 will be an update ---> Package systemd-sysv.x86_64 0:208-11.el7 will be updated ---> Package systemd-sysv.x86_64 0:208-11.el7_0.5 will be an update --> Running transaction check ---> Package python-six.noarch 0:1.3.0-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================= Package Arch Version Repository Size ============================================================================================================= Installing: docker x86_64 1.3.2-4.el7 rhel-7-server-extras-rpms 5.6 M docker-registry noarch 0.6.8-8.el7 rhel-7-server-extras-rpms 124 k Installing for dependencies: PyYAML x86_64 3.10-11.el7 rhel-7-server-rpms 153 k c-ares x86_64 1.10.0-3.el7 rhel-7-server-rpms 78 k libev x86_64 4.15-4.el7 rhel-7-server-extras-rpms 44 k libyaml x86_64 0.1.4-10.el7 rhel-7-server-rpms 55 k python-babel noarch 0.9.6-8.el7 rhel-7-server-rpms 1.4 M python-backports-lzma x86_64 0.0.2-7.el7 rhel-7-server-extras-rpms 26 k python-blinker noarch 1.3-2.el7 rhel-7-server-extras-rpms 93 k python-flask noarch 1:0.10.1-4.el7 rhel-7-server-extras-rpms 204 k python-gevent x86_64 1.0-2.el7 rhel-7-server-extras-rpms 273 k python-greenlet x86_64 0.4.2-3.el7 rhel-7-server-extras-rpms 26 k python-gunicorn noarch 18.0-2.el7 rhel-7-server-extras-rpms 171 k python-itsdangerous noarch 0.23-2.el7 rhel-7-server-extras-rpms 24 k python-jinja2 noarch 2.7.2-2.el7 rhel-7-server-optional-rpms 516 k python-markupsafe x86_64 0.11-10.el7 rhel-7-server-rpms 25 k python-requests noarch 1.1.0-8.el7 rhel-7-server-rpms 70 k python-six noarch 1.3.0-4.el7 rhel-7-server-rpms 18 k python-urllib3 noarch 1.5-8.el7 rhel-7-server-rpms 41 k python-werkzeug noarch 0.9.1-2.el7 rhel-7-server-extras-rpms 562 k Updating for dependencies: libgudev1 x86_64 208-11.el7_0.5 rhel-7-server-rpms 48 k systemd x86_64 208-11.el7_0.5 rhel-7-server-rpms 2.6 M systemd-libs x86_64 208-11.el7_0.5 rhel-7-server-rpms 153 k systemd-python x86_64 208-11.el7_0.5 rhel-7-server-rpms 83 k systemd-sysv x86_64 208-11.el7_0.5 rhel-7-server-rpms 36 k Transaction Summary ============================================================================================================= Install 2 Packages (+18 Dependent packages) Upgrade ( 5 Dependent packages) Total download size: 12 M Is this ok [y/d/N]: y Downloading packages: No Presto metadata available for rhel-7-server-rpms warning: /software/yum/x86_64/7Server/rhel-7-server-rpms/packages/c-ares-1.10.0-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Public key for c-ares-1.10.0-3.el7.x86_64.rpm is not installed (1/25): c-ares-1.10.0-3.el7.x86_64.rpm | 78 kB 00:00:03 (2/25): PyYAML-3.10-11.el7.x86_64.rpm | 153 kB 00:00:03 Public key for docker-registry-0.6.8-8.el7.noarch.rpm is not installed ] 113 kB/s | 358 kB 00:01:48 ETA (3/25): docker-registry-0.6.8-8.el7.noarch.rpm | 124 kB 00:00:04 (4/25): libgudev1-208-11.el7_0.5.x86_64.rpm | 48 kB 00:00:03 (5/25): libev-4.15-4.el7.x86_64.rpm | 44 kB 00:00:03 (6/25): libyaml-0.1.4-10.el7.x86_64.rpm | 55 kB 00:00:03 (7/25): python-backports-lzma-0.0.2-7.el7.x86_64.rpm | 26 kB 00:00:03 (8/25): python-blinker-1.3-2.el7.noarch.rpm | 93 kB 00:00:03 (9/25): python-babel-0.9.6-8.el7.noarch.rpm | 1.4 MB 00:00:10 (10/25): python-flask-0.10.1-4.el7.noarch.rpm | 204 kB 00:00:05 (11/25): python-gevent-1.0-2.el7.x86_64.rpm | 273 kB 00:00:04 (12/25): python-greenlet-0.4.2-3.el7.x86_64.rpm | 26 kB 00:00:03 (13/25): python-gunicorn-18.0-2.el7.noarch.rpm | 171 kB 00:00:04 (14/25): python-markupsafe-0.11-10.el7.x86_64.rpm | 25 kB 00:00:03 (15/25): python-itsdangerous-0.23-2.el7.noarch.rpm | 24 kB 00:00:03 (16/25): python-requests-1.1.0-8.el7.noarch.rpm | 70 kB 00:00:03 (17/25): python-six-1.3.0-4.el7.noarch.rpm | 18 kB 00:00:02 (18/25): python-urllib3-1.5-8.el7.noarch.rpm | 41 kB 00:00:02 (19/25): docker-1.3.2-4.el7.x86_64.rpm | 5.6 MB 00:00:38 Public key for python-jinja2-2.7.2-2.el7.noarch.rpm is not installed ] 274 kB/s | 8.9 MB 00:00:12 ETA (20/25): python-jinja2-2.7.2-2.el7.noarch.rpm | 516 kB 00:00:06 (21/25): systemd-libs-208-11.el7_0.5.x86_64.rpm | 153 kB 00:00:03 (22/25): python-werkzeug-0.9.1-2.el7.noarch.rpm | 562 kB 00:00:07 (23/25): systemd-python-208-11.el7_0.5.x86_64.rpm | 83 kB 00:00:03 (24/25): systemd-sysv-208-11.el7_0.5.x86_64.rpm | 36 kB 00:00:02 (25/25): systemd-208-11.el7_0.5.x86_64.rpm | 2.6 MB 00:00:18 ------------------------------------------------------------------------------------------------------------- Total 224 kB/s | 12 MB 00:00:56 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release Importing GPG key 0xFD431D51: Userid : "Red Hat, Inc. (release key 2) <security@redhat.com>" Fingerprint: 567e 347a d004 4ade 55ba 8a5f 199e 2f91 fd43 1d51 Package : redhat-release-server-7.0-1.el7.x86_64 (@anaconda/7.0) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release Is this ok [y/N]: y Importing GPG key 0x2FA658E0: Userid : "Red Hat, Inc. (auxiliary key) <security@redhat.com>" Fingerprint: 43a6 e49c 4a38 f4be 9abf 2a53 4568 9c88 2fa6 58e0 Package : redhat-release-server-7.0-1.el7.x86_64 (@anaconda/7.0) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : systemd-libs-208-11.el7_0.5.x86_64 1/30 Updating : systemd-208-11.el7_0.5.x86_64 2/30 Installing : libev-4.15-4.el7.x86_64 3/30 Installing : python-werkzeug-0.9.1-2.el7.noarch 4/30 Installing : python-babel-0.9.6-8.el7.noarch 5/30 Installing : python-markupsafe-0.11-10.el7.x86_64 6/30 Installing : python-jinja2-2.7.2-2.el7.noarch 7/30 Installing : python-blinker-1.3-2.el7.noarch 8/30 Installing : python-six-1.3.0-4.el7.noarch 9/30 Installing : python-urllib3-1.5-8.el7.noarch 10/30 Installing : python-requests-1.1.0-8.el7.noarch 11/30 Installing : c-ares-1.10.0-3.el7.x86_64 12/30 Installing : python-itsdangerous-0.23-2.el7.noarch 13/30 Installing : 1:python-flask-0.10.1-4.el7.noarch 14/30 Installing : python-backports-lzma-0.0.2-7.el7.x86_64 15/30 Installing : python-gunicorn-18.0-2.el7.noarch 16/30 Installing : python-greenlet-0.4.2-3.el7.x86_64 17/30 Installing : python-gevent-1.0-2.el7.x86_64 18/30 Installing : libyaml-0.1.4-10.el7.x86_64 19/30 Installing : PyYAML-3.10-11.el7.x86_64 20/30 Installing : docker-registry-0.6.8-8.el7.noarch 21/30 Updating : libgudev1-208-11.el7_0.5.x86_64 22/30 Installing : docker-1.3.2-4.el7.x86_64 23/30 Updating : systemd-python-208-11.el7_0.5.x86_64 24/30 Updating : systemd-sysv-208-11.el7_0.5.x86_64 25/30 Cleanup : systemd-python-208-11.el7.x86_64 26/30 Cleanup : libgudev1-208-11.el7.x86_64 27/30 Cleanup : systemd-sysv-208-11.el7.x86_64 28/30 Cleanup : systemd-208-11.el7.x86_64 29/30 Cleanup : systemd-libs-208-11.el7.x86_64 30/30 rhel-7-server-rpms/7Server/x86_64/productid | 1.7 kB 00:00:00 Verifying : python-jinja2-2.7.2-2.el7.noarch 1/30 Verifying : 1:python-flask-0.10.1-4.el7.noarch 2/30 Verifying : libgudev1-208-11.el7_0.5.x86_64 3/30 Verifying : docker-registry-0.6.8-8.el7.noarch 4/30 Verifying : libyaml-0.1.4-10.el7.x86_64 5/30 Verifying : python-greenlet-0.4.2-3.el7.x86_64 6/30 Verifying : docker-1.3.2-4.el7.x86_64 7/30 Verifying : python-gunicorn-18.0-2.el7.noarch 8/30 Verifying : python-backports-lzma-0.0.2-7.el7.x86_64 9/30 Verifying : systemd-208-11.el7_0.5.x86_64 10/30 Verifying : systemd-libs-208-11.el7_0.5.x86_64 11/30 Verifying : python-itsdangerous-0.23-2.el7.noarch 12/30 Verifying : c-ares-1.10.0-3.el7.x86_64 13/30 Verifying : python-requests-1.1.0-8.el7.noarch 14/30 Verifying : python-six-1.3.0-4.el7.noarch 15/30 Verifying : python-blinker-1.3-2.el7.noarch 16/30 Verifying : python-markupsafe-0.11-10.el7.x86_64 17/30 Verifying : python-babel-0.9.6-8.el7.noarch 18/30 Verifying : systemd-python-208-11.el7_0.5.x86_64 19/30 Verifying : python-werkzeug-0.9.1-2.el7.noarch 20/30 Verifying : python-gevent-1.0-2.el7.x86_64 21/30 Verifying : systemd-sysv-208-11.el7_0.5.x86_64 22/30 Verifying : libev-4.15-4.el7.x86_64 23/30 Verifying : python-urllib3-1.5-8.el7.noarch 24/30 Verifying : PyYAML-3.10-11.el7.x86_64 25/30 Verifying : systemd-sysv-208-11.el7.x86_64 26/30 Verifying : systemd-python-208-11.el7.x86_64 27/30 Verifying : systemd-libs-208-11.el7.x86_64 28/30 Verifying : systemd-208-11.el7.x86_64 29/30 Verifying : libgudev1-208-11.el7.x86_64 30/30 Installed: docker.x86_64 0:1.3.2-4.el7 docker-registry.noarch 0:0.6.8-8.el7 Dependency Installed: PyYAML.x86_64 0:3.10-11.el7 c-ares.x86_64 0:1.10.0-3.el7 libev.x86_64 0:4.15-4.el7 libyaml.x86_64 0:0.1.4-10.el7 python-babel.noarch 0:0.9.6-8.el7 python-backports-lzma.x86_64 0:0.0.2-7.el7 python-blinker.noarch 0:1.3-2.el7 python-flask.noarch 1:0.10.1-4.el7 python-gevent.x86_64 0:1.0-2.el7 python-greenlet.x86_64 0:0.4.2-3.el7 python-gunicorn.noarch 0:18.0-2.el7 python-itsdangerous.noarch 0:0.23-2.el7 python-jinja2.noarch 0:2.7.2-2.el7 python-markupsafe.x86_64 0:0.11-10.el7 python-requests.noarch 0:1.1.0-8.el7 python-six.noarch 0:1.3.0-4.el7 python-urllib3.noarch 0:1.5-8.el7 python-werkzeug.noarch 0:0.9.1-2.el7 Dependency Updated: libgudev1.x86_64 0:208-11.el7_0.5 systemd.x86_64 0:208-11.el7_0.5 systemd-libs.x86_64 0:208-11.el7_0.5 systemd-python.x86_64 0:208-11.el7_0.5 systemd-sysv.x86_64 0:208-11.el7_0.5 Complete! [root@DockerServer ~]# |
为了防止冲突,选择关闭防火墙:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@DockerServer ~]# systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Thu 2014-12-25 23:48:36 CST; 1h 1min ago Main PID: 992 (firewalld) CGroup: /system.slice/firewalld.service └─992 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Dec 25 23:48:36 DockerServer systemd[1]: Started firewalld - dynamic firewall daemon. [root@DockerServer ~]# [root@DockerServer ~]# systemctl stop firewalld.service [root@DockerServer ~]# systemctl disable firewalld.service rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@DockerServer ~]# [root@DockerServer ~]# systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled) Active: inactive (dead) Dec 26 07:48:29 DockerServer systemd[1]: Starting firewalld - dynamic firewall daemon... Dec 25 23:48:36 DockerServer systemd[1]: Started firewalld - dynamic firewall daemon. Dec 26 00:50:05 DockerServer systemd[1]: Stopping firewalld - dynamic firewall daemon... Dec 26 00:50:05 DockerServer systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@DockerServer ~]# |
这样,至此,Docker的安装就完成了。
下面是Docker的初步使用:
启动Docker:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@DockerServer ~]# systemctl status docker.service docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled) Active: inactive (dead) Docs: http://docs.docker.com [root@DockerServer ~]# [root@DockerServer ~]# systemctl start docker [root@DockerServer ~]# [root@DockerServer ~]# systemctl status docker docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled) Active: active (running) since Fri 2014-12-26 00:51:36 CST; 7s ago Docs: http://docs.docker.com Main PID: 32396 (docker) CGroup: /system.slice/docker.service └─32396 /usr/bin/docker -d --selinux-enabled -H fd:// Dec 26 00:51:34 DockerServer docker[32396]: 2014/12/26 00:51:34 docker daemon: 1.3.2 39fa2fa/1.3.2; ex...ver: Dec 26 00:51:34 DockerServer docker[32396]: [3611e2de] +job serveapi(fd://) Dec 26 00:51:34 DockerServer docker[32396]: [info] Listening for HTTP on fd () Dec 26 00:51:35 DockerServer docker[32396]: [3611e2de] +job init_networkdriver() Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] -job init_networkdriver() = OK (0) Dec 26 00:51:36 DockerServer docker[32396]: [info] Loading containers: Dec 26 00:51:36 DockerServer docker[32396]: [info] : done. Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] +job acceptconnections() Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] -job acceptconnections() = OK (0) Dec 26 00:51:36 DockerServer systemd[1]: Started Docker Application Container Engine. Hint: Some lines were ellipsized, use -l to show in full. [root@DockerServer ~]# [root@DockerServer ~]# |
让Docker随操作系统自动运行(开机启动):
1 2 3 |
[root@DockerServer ~]# systemctl enable docker ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service' [root@DockerServer ~]# |
查看Dcoker服务的状态:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@DockerServer ~]# systemctl status docker docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled) Active: active (running) since Fri 2014-12-26 00:51:36 CST; 1min 26s ago Docs: http://docs.docker.com Main PID: 32396 (docker) CGroup: /system.slice/docker.service └─32396 /usr/bin/docker -d --selinux-enabled -H fd:// Dec 26 00:51:34 DockerServer docker[32396]: 2014/12/26 00:51:34 docker daemon: 1.3.2 39fa2fa/1.3.2; ex...ver: Dec 26 00:51:34 DockerServer docker[32396]: [3611e2de] +job serveapi(fd://) Dec 26 00:51:34 DockerServer docker[32396]: [info] Listening for HTTP on fd () Dec 26 00:51:35 DockerServer docker[32396]: [3611e2de] +job init_networkdriver() Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] -job init_networkdriver() = OK (0) Dec 26 00:51:36 DockerServer docker[32396]: [info] Loading containers: Dec 26 00:51:36 DockerServer docker[32396]: [info] : done. Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] +job acceptconnections() Dec 26 00:51:36 DockerServer docker[32396]: [3611e2de] -job acceptconnections() = OK (0) Dec 26 00:51:36 DockerServer systemd[1]: Started Docker Application Container Engine. Hint: Some lines were ellipsized, use -l to show in full. [root@DockerServer ~]# [root@DockerServer ~]# ps -ef | grep docker root 32396 1 0 00:51 ? 00:00:00 /usr/bin/docker -d --selinux-enabled -H fd:// root 32514 2869 0 00:53 pts/0 00:00:00 grep --color=auto docker [root@DockerServer ~]# |
初步使用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[root@DockerServer ~]# docker version Client version: 1.3.2 Client API version: 1.15 Go version (client): go1.3.1 Git commit (client): 39fa2fa/1.3.2 OS/Arch (client): linux/amd64 Server version: 1.3.2 Server API version: 1.15 Go version (server): go1.3.1 Git commit (server): 39fa2fa/1.3.2 [root@DockerServer ~]# [root@DockerServer ~]# docker info Containers: 0 Images: 0 Storage Driver: devicemapper Pool Name: docker-253:0-103054830-pool Pool Blocksize: 65.54 kB Data file: /var/lib/docker/devicemapper/devicemapper/data Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata Data Space Used: 307.2 MB Data Space Total: 107.4 GB Metadata Space Used: 725 kB Metadata Space Total: 2.147 GB Library Version: 1.02.84-RHEL7 (2014-03-26) Execution Driver: native-0.2 Kernel Version: 3.10.0-123.el7.x86_64 Operating System: Red Hat Enterprise Linux [root@DockerServer ~]# [root@DockerServer ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE [root@DockerServer ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@DockerServer ~]# |
————————————————————————
Finished。