-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
773 lines (327 loc) · 30.1 KB
/
index.html
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
<!DOCTYPE html>
<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
<link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
<style>
.pace .pace-progress {
background: #1E92FB; /*��������ɫ*/
height: 2px;
}
.pace .pace-progress-inner {
box-shadow: 0 0 10px #1E92FB, 0 0 5px #1E92FB; /*��Ӱ��ɫ*/
}
.pace .pace-activity {
border-top-color: #1E92FB; /*�ϱ߿���ɫ*/
border-left-color: #1E92FB; /*��߿���ɫ*/
}
</style>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT" />
<link rel="alternate" href="/atom.xml" title="Retr02" type="application/atom+xml" />
<meta name="description" content="Retr02">
<meta property="og:type" content="website">
<meta property="og:title" content="Retr02">
<meta property="og:url" content="http://retr02.com/index.html">
<meta property="og:site_name" content="Retr02">
<meta property="og:description" content="Retr02">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Retr02">
<meta name="twitter:description" content="Retr02">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Muse',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://retr02.com/"/>
<title>Retr02</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Retr02</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">欲成大树勿与草争</p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
<li class="menu-item menu-item-rss">
<a href="/atom.xml" rel="section">
<i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
rss
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://retr02.com/2018/10/26/Docker Quick Start/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Retr02">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Retr02">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2018/10/26/Docker Quick Start/" itemprop="url">Docker Quick Start</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2018-10-26T00:27:15+08:00">
2018-10-26
</time>
</span>
<div class="post-wordcount">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">字数统计:</span>
<span title="字数统计">
1,744
</span>
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">阅读时长 ≈</span>
<span title="阅读时长">
8
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p><img src="/images/dockerLogo.png" alt=""></p>
<p>Docker 是一个开源的应用容器引擎,而一个容器containers其实是一个虚拟化的独立的环境,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。</p>
<ul>
<li>Docker 的局限性之一,它只能用在 64 位的操作系统上。</li>
</ul>
<p> <strong>目录</strong><br><!-- TOC --></p>
<ul>
<li><a href="#新版本安装方式">新版本安装方式</a></li>
<li><a href="#旧版本安装方式">旧版本安装方式</a></li>
<li><a href="#命令介绍">命令介绍</a></li>
<li><a href="#服务管理">服务管理</a></li>
<li><a href="#镜像管理">镜像管理</a><ul>
<li><a href="#通过容器创建镜像">通过容器创建镜像</a></li>
<li><a href="#通过dockerfile创建镜像">通过DockerFile创建镜像</a></li>
<li><a href="#发布自己的镜像">发布自己的镜像</a></li>
<li><a href="#镜像中安装环境">镜像中安装环境</a></li>
</ul>
</li>
<li><a href="#容器管理">容器管理</a><ul>
<li><a href="#容器服务管理">容器服务管理</a></li>
<li><a href="#进入容器">进入容器</a></li>
</ul>
</li>
<li><a href="#文件拷贝">文件拷贝</a></li>
<li><a href="#docker私有仓库搭建">Docker私有仓库搭建</a><ul>
<li><a href="#部署registry">部署registry</a></li>
<li><a href="#部署管理工具harbor">部署管理工具Harbor</a></li>
</ul>
</li>
<li><a href="#卸载旧版本">卸载旧版本</a></li>
<li><a href="#参考资料">参考资料</a></li>
<li><a href="#错误记录">错误记录</a></li>
</ul>
<!-- /TOC -->
<hr>
<p>Docker 从 1.13 版本之后采用时间线的方式作为版本号,分为社区版 <code>CE</code> 和企业版 <code>EE</code>,社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如经过官方测试认证过的基础设施、容器、插件等。</p>
<p>社区版按照 <code>stable</code> 和 <code>edge</code> 两种方式发布,每个季度更新 <code>stable</code> 版本,如 17.06,17.09;每个月份更新 <code>edge</code> 版本,如17.09,17.10。</p>
<p>下面教程运行在 <code>Centos</code> 中</p>
<p>#新版本安装方式</p>
<p>Docker官方的安装教程 <a href="https://docs.docker.com/install/linux/docker-ce/centos/" target="_blank" rel="noopener">轻点这里</a></p>
<p>安装一些必要的系统工具</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install -y yum-utils device-mapper-persistent-data lvm2</span><br></pre></td></tr></table></figure>
<p>添加软件源<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># docker 官方源</span><br><span class="line">sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</span><br><span class="line"># 阿里云源</span><br><span class="line">sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo</span><br></pre></td></tr></table></figure></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 更新yum缓存</span><br><span class="line">$ sudo yum makecache fast</span><br><span class="line"># 安装docker-ce</span><br><span class="line">$ sudo yum install docker-ce</span><br></pre></td></tr></table></figure>
<p>如果你想指定<code>docker-ce</code>的版本,那么可以尝试执行以下命令,列出当前repo中的<code>docker-ce</code>的所有可用版本<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">$ yum list [package] --showduplicates | sort -r </span><br><span class="line"> docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable </span><br><span class="line"> docker-ce.x86_64 17.03.0.ce-1.el7.centos doscker-ce-stable </span><br><span class="line"></span><br><span class="line"># 选择要安装的版本</span><br><span class="line">$ sudo yum install docker-ce-<VERSION></span><br><span class="line"># 选择安装18.06.1.ce-3.el7</span><br><span class="line">$ sudo yum install docker-ce.18.06.1.ce-3.el7</span><br></pre></td></tr></table></figure></p>
<p>启动Docker后台服务</p>
<h1 id="旧版本安装方式"><a href="#旧版本安装方式" class="headerlink" title="旧版本安装方式"></a>旧版本安装方式</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo install docker</span><br></pre></td></tr></table></figure>
<h1 id="命令介绍"><a href="#命令介绍" class="headerlink" title="命令介绍"></a>命令介绍</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">$ docker --help</span><br><span class="line"></span><br><span class="line">管理命令:</span><br><span class="line"> container 管理容器</span><br><span class="line"> image 管理镜像</span><br><span class="line"> network 管理网络</span><br><span class="line"> node 节点管理Swarm节点</span><br><span class="line"> plugin 插件管理</span><br><span class="line"> service 服务管理</span><br><span class="line"> system Docker系统管理</span><br><span class="line"> volume 管理卷</span><br><span class="line">命令:</span><br><span class="line"> attach 附加到正在运行的容器</span><br><span class="line"> build 通过Dockerfile构建一个镜像</span><br><span class="line"> commit 从容器创建一个新的镜像</span><br><span class="line"> create 创建一个新容器</span><br><span class="line"> exec 在正在运行的容器中运行命令</span><br><span class="line"> history 显示镜像的历史记录 </span><br><span class="line"> images 列出镜像列表</span><br><span class="line"> kill 杀死一个或多个正在运行的容器</span><br><span class="line"> rm 移除一个或多个容器</span><br><span class="line"> rmi 移除一个或多个镜像</span><br><span class="line"> run 在新容器中运行指令</span><br><span class="line"> start 启动一个或多个已停止的容器</span><br><span class="line"> pull 从registry拉取镜像或存储库</span><br><span class="line"> push 将镜像或存储库推送到registry</span><br><span class="line"> ps 列出容器列表</span><br><span class="line"> search 在Docker Hub中搜索镜像</span><br><span class="line"> top 显示容器的运行进程</span><br></pre></td></tr></table></figure>
<h1 id="服务管理"><a href="#服务管理" class="headerlink" title="服务管理"></a>服务管理</h1><p>$ su root<br>service docker start 启动Docker服务<br>service docker stop 停止Docker服务<br>service docker status 查看Docker服务状态<br>chkconfig docker on 设置为开机启动<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure></p>
<h1 id="镜像管理"><a href="#镜像管理" class="headerlink" title="镜像管理"></a>镜像管理</h1><p>镜像可以看作是一个微小的系统,内部就是一个运行环境<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">docker pull ubuntu:latest #拉取ubuntu镜像到本地</span><br><span class="line">docker images #查看已拉取到本地的镜像列表</span><br><span class="line">docker rmi [image_id] #通过镜像ID删除镜像</span><br><span class="line"></span><br><span class="line"># 删除所有镜像</span><br><span class="line"># none 默认为docker.io</span><br><span class="line">docker rmi $(docker images | grep none | awk '{print $3}' | sort -r)</span><br><span class="line"></span><br><span class="line"># 以交互模式运行nginx容器,在容器内执行/bin/bash命令,可使用exit命令退出bash</span><br><span class="line">docker run -t -i nginx:latest /bin/bash</span><br></pre></td></tr></table></figure></p>
<h2 id="通过容器创建镜像"><a href="#通过容器创建镜像" class="headerlink" title="通过容器创建镜像"></a>通过容器创建镜像</h2><p>我们可以通过以下两种方式对镜像进行更改<br> 1.从已经创建的容器中更新镜像,并且提交这个镜像<br> 2.使用Dockerfile指令来创建一个新的镜像</p>
<p>下面通过已存在的容器创建一个新的镜像<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker commit -m="My Image" -a="navven" 3ace90ecb4adb navven/nginx:v1.2.1</span><br></pre></td></tr></table></figure></p>
<blockquote>
<p>上面命令参数说明:</p>
<ul>
<li><code>-m</code> 描述提交内容</li>
<li><code>-a</code> 标识镜像坐着</li>
<li><code>3ace90ecb4adb</code> 这是容器ID,不是镜像ID</li>
<li><code>navven/nginx:v1.2.1</code> 被创建的镜像名</li>
</ul>
</blockquote>
<h2 id="通过DockerFile创建镜像"><a href="#通过DockerFile创建镜像" class="headerlink" title="通过DockerFile创建镜像"></a>通过DockerFile创建镜像</h2><p>假设创建一个node.js 镜像, 首先在node.js 项目根目录创建文件<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">touch Dockerfile .dockerignore</span><br></pre></td></tr></table></figure></p>
<p><code>.dockerignore</code> 文件用来排除无需打包进image文件的路径,如果你没有路径要排除,这个文件可以不新建.<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">.git</span><br><span class="line">node_modules</span><br><span class="line">np-debug.log</span><br></pre></td></tr></table></figure></p>
<p>Dockerfile文件内容<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">FROM node:8.2</span><br><span class="line">COPY . /local</span><br></pre></td></tr></table></figure></p>
<h2 id="发布自己的镜像"><a href="#发布自己的镜像" class="headerlink" title="发布自己的镜像"></a>发布自己的镜像</h2><h2 id="镜像中安装环境"><a href="#镜像中安装环境" class="headerlink" title="镜像中安装环境"></a>镜像中安装环境</h2><h1 id="容器管理"><a href="#容器管理" class="headerlink" title="容器管理"></a>容器管理</h1><h2 id="容器服务管理"><a href="#容器服务管理" class="headerlink" title="容器服务管理"></a>容器服务管理</h2><h2 id="进入容器"><a href="#进入容器" class="headerlink" title="进入容器"></a>进入容器</h2><h1 id="文件拷贝"><a href="#文件拷贝" class="headerlink" title="文件拷贝"></a>文件拷贝</h1><h1 id="Docker私有仓库搭建"><a href="#Docker私有仓库搭建" class="headerlink" title="Docker私有仓库搭建"></a>Docker私有仓库搭建</h1><h2 id="部署registry"><a href="#部署registry" class="headerlink" title="部署registry"></a>部署registry</h2><h2 id="部署管理工具Harbor"><a href="#部署管理工具Harbor" class="headerlink" title="部署管理工具Harbor"></a>部署管理工具Harbor</h2><h1 id="卸载旧版本"><a href="#卸载旧版本" class="headerlink" title="卸载旧版本"></a>卸载旧版本</h1><h1 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h1><p>官方英文资源 <a href="https://docs.docker.com/" target="_blank" rel="noopener">https://www.docker-cn.com/</a><br>中文资源 <a href="https://www.docker-cn.com/" target="_blank" rel="noopener">https://www.docker-cn.com/</a> </p>
<h1 id="错误记录"><a href="#错误记录" class="headerlink" title="错误记录"></a>错误记录</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">博主在执行`sudo yum install docker-ce` 的时候抛出以下异常</span><br></pre></td></tr></table></figure>
<p>Transaction check error:<br> file /usr/bin/docker from install of docker-ce-cli-1:18.09.0-3.el7.x86_64 conflicts with file from pack<br>age docker-common-2:1.13.1-75.git8633870.el7.centos.x86_64</p>
<h2 id="错误概要"><a href="#错误概要" class="headerlink" title="错误概要"></a>错误概要</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">如果你也遇到了以上错误那请执行</span><br></pre></td></tr></table></figure>
<p>rm /usr/bin/docker 删除出现冲突的docker文件<br>$ yum list installed | grep docker 列出已安装的docker安装包<br>$ yum -y remove [docker.version] 删除安装包<br>$ yum –y remove docker.x86_64<br>$ yum -y remove docker-client.x86_64<br>$ yum -y remove docker-common.x86_64<br>$ rm -rf /var/lib/docker 删除docker镜像<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">**删除完毕之后可以检查是否删除成功**</span><br></pre></td></tr></table></figure></p>
<p>$ rm -rf /var/lib/docker<br>$<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">然后再次执行以下命令就可以成功安装docker-ce了</span><br></pre></td></tr></table></figure></p>
<p>sudo yum install docker-ce<br><code>`</code></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
</section>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image"
src="/images/avatar.jpg"
alt="Retr02" />
<p class="site-author-name" itemprop="name">Retr02</p>
<p class="site-description motion-element" itemprop="description">Retr02</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">1</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
</nav>
<div class="feed-link motion-element">
<a href="/atom.xml" rel="alternate">
<i class="fa fa-rss"></i>
RSS
</a>
</div>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/Navven" target="_blank" title="GitHub">
<i class="fa fa-fw fa-github"></i>GitHub</a>
</span>
</div>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© <span itemprop="copyrightYear">2018</span>
<span class="with-love" id="heart">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Retr02</span>
</div>
<div class="powered-by">    Tip: 感谢一路上有你</div>
<span class="post-meta-divider"></span>
<br/>
<div class="theme-info"><script async="" src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script> </div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>
</body>
</html>