-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc018.html
616 lines (567 loc) · 121 KB
/
c018.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
<!DOCTYPE html><html lang="zh-CN" data-theme="dark"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"><title>docker学习记录 | 伴随的小站</title><meta name="keywords" content="docker"><meta name="author" content="伴随"><meta name="copyright" content="伴随"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#18171d"><meta name="mobile-web-app-capable" content="yes"><meta name="apple-touch-fullscreen" content="yes"><meta name="apple-mobile-web-app-title" content="docker学习记录"><meta name="application-name" content="docker学习记录"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="#18171d"><meta property="og:type" content="article"><meta property="og:title" content="docker学习记录"><meta property="og:url" content="https://ctext.top/c018.html"><meta property="og:site_name" content="伴随的小站"><meta property="og:description" content="Docker pmm 1234567891011121314151617181920212223242526272829303132333435363738# admindocker run -d --name&#x3D;pmm --restart&#x3D;always \-p 2812:2812 -p 2813:8"><meta property="og:locale" content="zh-CN"><meta property="og:image" content="https://up.ctext.top/article/2024/06/docker.png"><meta property="article:author" content="伴随"><meta property="article:tag"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://up.ctext.top/article/2024/06/docker.png"><meta name="description" content="Docker pmm 1234567891011121314151617181920212223242526272829303132333435363738# admindocker run -d --name&#x3D;pmm --restart&#x3D;always \-p 2812:2812 -p 2813:8"><link rel="shortcut icon" href="https://up.ctext.top/favicon.svg"><link rel="canonical" href="https://ctext.top/c018.html"><link rel="preconnect" href="//cdn.cbd.int"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="google-site-verification" content="xxx"/><meta name="baidu-site-verification" content="codeva-ulCeD8b6u5"/><meta name="msvalidate.01" content="xxx"/><meta name="sogou_site_verification" content="YdTw3LB3JQ"/><meta name="360-site-verification" content="5f481d0e3172c0894747aba683bb1191"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.cbd.int/@fortawesome/fontawesome-free@6.4.0/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/node-snackbar@0.1.16/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/@fancyapps/ui@5.0.28/dist/fancybox/fancybox.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.0/swiper/swiper.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?643616874a8f4f5ed38e6146dfd84820";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = {
linkPageTop: undefined,
peoplecanvas: undefined,
postHeadAiDescription: {"enable":true,"gptName":null,"mode":"tianli","switchBtn":false,"btnLink":null,"randomNum":3,"basicWordCount":1000,"key":"XlJ1hsZTEze","Referer":"/"},
diytitle: {"enable":true,"leaveTitle":"分享使快乐加倍!(´▽`)","backTitle":"慢慢看~ヾ(•ω•`)o"},
LA51: undefined,
greetingBox: {"enable":true,"default":"晚上好👋","list":[{"greeting":"晚安啦🌙,做个好梦,期待明天的美好!😴💤","startTime":0,"endTime":6},{"greeting":"早上好🌞,新的一天,愿你充满活力和正能量!💪🌈","startTime":6,"endTime":10},{"greeting":"上午好👋,工作/学习加油,期待你的出色表现!🌟📚","startTime":10,"endTime":12},{"greeting":"午餐时间到🍽️,好好吃饭,下午继续加油!🍛💼","startTime":12,"endTime":14},{"greeting":"下午好👋,午后时光,放松心情,享受片刻宁静。☕️💆♀️","startTime":14,"endTime":17},{"greeting":"傍晚好,一天即将结束,为自己点个赞吧!👍🎉","startTime":17,"endTime":19},{"greeting":"晚餐时间啦🍲,享受美食,犒劳一下自己吧!🍽️🥳","startTime":19,"endTime":21},{"greeting":"晚上好🌃,夜晚的时光,放松身心,好好休息吧!🛌💤","startTime":21,"endTime":24}]},
twikooEnvId: '',
commentBarrageConfig:undefined,
music_page_default: "nav_music",
root: '/',
preloader: {"source":3},
friends_vue_info: undefined,
navMusic: true,
mainTone: {"mode":"api","api":"https://color.ctext.top/api?img=","cover_change":true},
authorStatus: {"skills":["🤖️ 数码科技爱好者","🔍 分享与热心帮助","🏠 智能家居小能手","🔨 设计开发一条龙"]},
algolia: undefined,
localSearch: undefined,
translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简","rightMenuMsgToTraditionalChinese":"转为繁体","rightMenuMsgToSimplifiedChinese":"转为简体"},
noticeOutdate: undefined,
highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":330},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
simplehomepage: true,
post: false
},
runtime: '天',
date_suffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: {"copy":true,"copyrightEbable":false,"limitCount":50,"languages":{"author":"作者: 伴随","link":"链接: ","source":"来源: 伴随的小站","info":"著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。","copySuccess":"复制成功,复制和转载请标注本文地址"}},
lightbox: 'fancybox',
Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#425AEF","bgDark":"#1f1f1f","position":"top-center"},
source: {
justifiedGallery: {
js: 'https://cdn.cbd.int/flickr-justified-gallery@2.1.2/dist/fjGallery.min.js',
css: 'https://cdn.cbd.int/flickr-justified-gallery@2.1.2/dist/fjGallery.css'
}
},
isPhotoFigcaption: false,
islazyload: true,
isAnchor: false,
shortcutKey: undefined,
autoDarkmode: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
configTitle: '伴随的小站',
title: 'docker学习记录',
postAI: 'true',
pageFillDescription: 'Docker, pmm, 修改容器名, 设置日志大小, 自动重启容器, docker镜像命令, docker容器命令, 查看日志, 查看容器中的进程, 从容器内拷贝到主机, 测试, 可视化(portsiner), commit镜像, 容器数据卷, 指定路径挂载, 匿名挂载, 具名挂载, 扩展, 安装MySQL并且将数据文件挂载到主机中, DockerFile, 配置tomcat环境的DockerFile脚本, 提交到远程仓库, docker-compose, compose相关命令, 镜像和容器的导入导出在安装客户端的主机上添加监控的实例查询存在的节点修改容器名设置日志大小自动重启容器容器或者容器名镜像命令显示版本信息显示的系统信息命令帮助命令查询当前容器中的镜像搜索镜像软件名下载镜像默认下载最新版本软件名指定版本下载软件名版本号指定把版本号时必须保证中存在删除镜像软件名或者多个用空格隔开删除所有容器命令下载一个容器启动一个容器参数容器名容器名称后台运行启动并且进入容器指定端口主机端口容器端口主机端口容器端口容器端口不指定则随机端口用完即删用于测试运行指定名称为后台方式运行指定主机端口容器端口进入正在运行的容器容器进入容器容器进入容器正在执行的终端查询运行的容器查询运行过的容器显示指定个数退出容器退出并且停止退出不停止删除容器容器或名称强制删除无论是否运行查看容器的占用情况容器启动容器容器停止容器容器重启容器容器强制停止容器查看日志参数容器显示所有日志以及时间戳显示行查看容器中的进程容器从容器内拷贝到主机容器文件路径主机路径测试安装可视化文档官方文档文档安装命令镜像提交作者名称提交的内容注释容器数据卷指定路径挂载将容器中的数据挂载到主机中其实就是容器的持久化和同步主机目录容器目录将的目录挂载到主机中匿名挂载时不指定主机目录查看镜像配置这里目录为随机目录具名挂载时指定一个主机名称而不指定目录查看镜像配置这里目录为我们指定的目录扩展还可以指定权限只读可读可写如果为只读那么容器中的配置文件无法修改只能主机来修改安装并且将数据文件挂载到主机中下载启动指定挂载目录配置文件指定挂载目录数据库文件指定连接密码指定版本基础镜像指定镜像作者镜像构建是需要运行的命令添加内容镜像工作目录挂载的目录端口继承镜像时执行该命令类似将文件拷贝到镜像中设置环境变量配置环境的脚本编写脚本初始容器作者名称拷贝文件添加依赖添加依赖工作目录配置环境变量端口启动脚本编译脚本文件指定镜像名称和版本指定脚本文件指定当前目录启动镜像提交到远程仓库容器编排技术相关命令查看当前正在运行的项目创建并启动容器指定文件位置不指定默认当前位置指定项目名称默认目录名后台运行构建容器停止验证并查看文件有错误时会提示行号远程访问数据持久化这一行是设置密码指定挂载目录配置文件指定挂载目录数据库文件镜像和容器的导入导出导出指定路径指定镜像名称导入镜像路径容器导入导出导出文件全路径镜像名称导入文件全路径导出是文件后缀为保存的是镜像保存的是容器用来载入镜像包用来载入容器包但两者都会恢复为镜像不能对载入的镜像重命名而可以为镜像指定新名称不能载入容器包能载入镜像包但不能使用',
isPost: true,
isHome: false,
isHighlightShrink: false,
isToc: true,
postUpdate: '2024-06-15 21:45:03',
postMainColor: '#a8caeb',
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: (key, value, ttl) => {
if (ttl === 0) return
const now = Date.now()
const expiry = now + ttl * 86400000
const item = {
value,
expiry
}
localStorage.setItem(key, JSON.stringify(item))
},
get: key => {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = Date.now()
if (now > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
Object.keys(attr).forEach(key => {
script.setAttribute(key, attr[key])
})
document.head.appendChild(script)
})
win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onerror = reject
link.onload = link.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
link.onload = link.onreadystatechange = null
resolve()
}
document.head.appendChild(link)
})
win.activateDarkMode = () => {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#18171d')
}
}
win.activateLightMode = () => {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#f7f9fe')
}
}
const t = saveToLocal.get('theme')
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
const now = new Date()
const hour = now.getHours()
const isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(e => {
if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><link rel="stylesheet" href="/css/font.css"><link rel="stylesheet" href="/css/welcome.css"><link rel="stylesheet" href="/css/imgloaded.css"><link rel="stylesheet" href="/css/hideRolling.css"><link rel="stylesheet" href="/css/countdown.css"><link rel="stylesheet" href="/css/essay-animation.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css" media="defer" onload="this.media='all'"><script src="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js"></script><!-- hexo injector head_end end --><meta name="generator" content="Hexo 7.3.0"></head><body data-type="anzhiyu"><div id="web_bg"></div><div id="an_music_bg"></div><div id="loading-box" onclick="document.getElementById("loading-box").classList.add("loaded")"><div class="loading-bg"><img class="loading-img nolazyload" alt="加载头像" src="https://up.ctext.top/avatar.png"/><div class="loading-image-dot"></div></div></div><script>const preloader = {
endLoading: () => {
document.getElementById('loading-box').classList.add("loaded");
},
initLoading: () => {
document.getElementById('loading-box').classList.remove("loaded")
}
}
window.addEventListener('load',()=> { preloader.endLoading() })
setTimeout(function(){preloader.endLoading();},10000)
if (true) {
document.addEventListener('pjax:send', () => { preloader.initLoading() })
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.1.10/progress_bar/progress_bar.css"/><script async="async" src="https://cdn.cbd.int/pace-js@1.2.4/pace.min.js" data-pace-options="{ "restartOnRequestAfter":false,"eventLag":false}"></script><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><div id="nav-group"><span id="blog_name"><div class="back-home-button"><i class="anzhiyufont anzhiyu-icon-grip-vertical"></i><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">关于</div><div class="back-menu-list"><a class="back-menu-item" href="/about/" title="我"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/orange.svg" alt="我"/><span class="back-menu-item-text">我</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">博客</div><div class="back-menu-list"><a class="back-menu-item" href="/album/" title="我的相册"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/strawberry.svg" alt="我的相册"/><span class="back-menu-item-text">我的相册</span></a><a class="back-menu-item" href="/essay/" title="记录生活"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/apple.svg" alt="记录生活"/><span class="back-menu-item-text">记录生活</span></a></div></div></div></div><a id="site-name" href="/" accesskey="h"><div class="title">伴随的小站</div><i class="anzhiyufont anzhiyu-icon-house-chimney"></i></a></span><div class="mask-name-container"><div id="name-container"><a id="page-name" href="javascript:anzhiyu.scrollToDest(0, 500)">PAGE_NAME</a></div></div><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 文章</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/"><i class="anzhiyufont anzhiyu-icon-grip-vertical faa-tada" style="font-size: 0.9em;"></i><span> 主页</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/archives/"><i class="anzhiyufont anzhiyu-icon-box-archive faa-tada" style="font-size: 0.9em;"></i><span> 总览</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><i class="anzhiyufont anzhiyu-icon-shapes faa-tada" style="font-size: 0.9em;"></i><span> 分类</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><i class="anzhiyufont anzhiyu-icon-tags faa-tada" style="font-size: 0.9em;"></i><span> 标签</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 我的</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/growth.html"><i class="anzhiyufont anzhiyu-icon-heartbeat faa-tada" style="font-size: 0.9em;"></i><span> 博客岁月</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/music/"><i class="anzhiyufont anzhiyu-icon-music faa-tada" style="font-size: 0.9em;"></i><span> 音乐馆</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/"><i class="anzhiyufont anzhiyu-icon-images faa-tada" style="font-size: 0.9em;"></i><span> 相册集</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/essay/"><i class="anzhiyufont anzhiyu-icon-lightbulb faa-tada" style="font-size: 0.9em;"></i><span> 记录生活</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 小工具</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/air-conditioner/"><i class="anzhiyufont anzhiyu-icon-fan faa-tada" style="font-size: 0.9em;"></i><span> 小空调</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/gradation/"><i class="anzhiyufont anzhiyu-icon-envelope faa-tada" style="font-size: 0.9em;"></i><span> 渐变背景生成</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/9abe.html"><i class="anzhiyufont anzhiyu-icon-artstation faa-tada" style="font-size: 0.9em;"></i><span> tag-plugins文档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/nav"><i class="anzhiyufont anzhiyu-icon-link faa-tada" style="font-size: 0.9em;"></i><span> 网址导航</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://map.ctext.top"><i class="anzhiyufont anzhiyu-icon-keyboard faa-tada" style="font-size: 0.9em;"></i><span> 飞车随机选图工具</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 关于</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/about/"><i class="anzhiyufont anzhiyu-icon-paper-plane faa-tada" style="font-size: 0.9em;"></i><span> 关于自己</span></a></li><li><a class="site-page child faa-parent animated-hover" href="javascript:toRandomPost()"><i class="anzhiyufont anzhiyu-icon-shoe-prints1 faa-tada" style="font-size: 0.9em;"></i><span> 随便逛逛</span></a></li></ul></div></div></div><div id="nav-right"><div class="nav-button" id="randomPost_button"><a class="site-page" onclick="toRandomPost()" title="随机前往一个文章" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-dice"></i></a></div><input id="center-console" type="checkbox"/><label class="widget" for="center-console" title="中控台" onclick="anzhiyu.switchConsole();"><i class="left"></i><i class="widget center"></i><i class="widget right"></i></label><div id="console"><div class="console-card-group-reward"><ul class="reward-all console-card"><li class="reward-item"><a href="https://up.ctext.top/pay/wx.png" target="_blank"><img class="post-qr-code-img" alt="微信" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/pay/wx.png"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://up.ctext.top/pay/zfb.png" target="_blank"><img class="post-qr-code-img" alt="支付宝" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/pay/zfb.png"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div><div class="console-card-group"><div class="console-card-group-left"><div class="console-card" id="card-newest-comments"><div class="card-content"><div class="author-content-item-tips">互动</div><span class="author-content-item-title"> 最新评论</span></div><div class="aside-list"><span>正在加载中...</span></div></div></div><div class="console-card-group-right"><div class="console-card tags"><div class="card-content"><div class="author-content-item-tips">音乐</div><span class="author-content-item-title">灵魂的碰撞💥</span></div></div><div class="console-card history"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-box-archiv"></i><span>文章</span></div><div class="card-archives"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
<i class="anzhiyufont anzhiyu-icon-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/11/"><span class="card-archive-list-date">十一月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/10/"><span class="card-archive-list-date">十月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">2</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/08/"><span class="card-archive-list-date">八月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">3</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/07/"><span class="card-archive-list-date">七月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">2</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/06/"><span class="card-archive-list-date">六月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">5</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/05/"><span class="card-archive-list-date">五月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">2</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/04/"><span class="card-archive-list-date">四月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">3</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/03/"><span class="card-archive-list-date">三月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">4</span><span>篇</span></div></a></li></ul></div><hr/></div></div></div><div class="button-group"><div class="console-btn-item"><a class="darkmode_switchbutton" title="显示模式切换" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-moon"></i></a></div><div class="console-btn-item" id="consoleHideAside" onclick="anzhiyu.hideAsideBtn()" title="边栏显示控制"><a class="asideSwitch"><i class="anzhiyufont anzhiyu-icon-arrows-left-right"></i></a></div><div class="console-btn-item" id="consoleMusic" onclick="anzhiyu.musicToggle()" title="音乐开关"><a class="music-switch"><i class="anzhiyufont anzhiyu-icon-music"></i></a></div></div><div class="console-mask" onclick="anzhiyu.hideConsole()" href="javascript:void(0);"></div></div><div class="nav-button" id="nav-totop"><a class="totopbtn" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i><span id="percent" onclick="anzhiyu.scrollToDest(0,500)">0</span></a></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);" title="切换"><i class="anzhiyufont anzhiyu-icon-bars"></i></a></div></div></div></nav><div id="post-info"><div id="post-firstinfo"><div class="meta-firstline"><a class="post-meta-original">原创</a><span class="post-meta-categories"><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-inbox post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%AC%94%E8%AE%B0/" itemprop="url">笔记</a></span><span class="article-meta tags"><a class="article-meta__tags" href="/tags/docker/" tabindex="-1" itemprop="url"> <span> <i class="anzhiyufont anzhiyu-icon-hashtag"></i>docker</span></a></span></div></div><h1 class="post-title" itemprop="name headline">docker学习记录</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="anzhiyufont anzhiyu-icon-calendar-days post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" itemprop="dateCreated datePublished" datetime="2024-06-15T13:45:03.000Z" title="发表于 2024-06-15 21:45:03">2024-06-15</time><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-history post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" itemprop="dateCreated datePublished" datetime="2024-06-15T13:45:03.000Z" title="更新于 2024-06-15 21:45:03">2024-06-15</time></span></div><div class="meta-secondline"><span class="post-meta-separator"></span><span class="post-meta-wordcount"><i class="anzhiyufont anzhiyu-icon-file-word post-meta-icon" title="文章字数"></i><span class="post-meta-label" title="文章字数">字数总计:</span><span class="word-count" title="文章字数">2.1k</span><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-clock post-meta-icon" title="阅读时长"></i><span class="post-meta-label" title="阅读时长">阅读时长:</span><span>9分钟</span></span><span class="post-meta-separator"></span><span class="post-meta-pv-cv" id="" data-flag-title="docker学习记录"><i class="anzhiyufont anzhiyu-icon-fw-eye post-meta-icon"></i><span class="post-meta-label" title="阅读量">阅读量:</span><span id="busuanzi_value_page_pv"><i class="anzhiyufont anzhiyu-icon-spinner anzhiyu-spin"></i></span></span><span class="post-meta-separator"> </span><span class="post-meta-position" title="作者IP属地为北京"><i class="anzhiyufont anzhiyu-icon-location-dot"></i>北京</span></div></div></div><section class="main-hero-waves-area waves-area"><svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"></path></defs><g class="parallax"><use href="#gentle-wave" x="48" y="0"></use><use href="#gentle-wave" x="48" y="3"></use><use href="#gentle-wave" x="48" y="5"></use><use href="#gentle-wave" x="48" y="7"></use></g></svg></section><div id="post-top-cover"><img class="nolazyload" id="post-top-bg" src="https://up.ctext.top/article/2024/06/docker.png"></div></header><main id="blog-container"><div class="layout" id="content-inner"><div id="post"><div class="post-ai-description"><div class="ai-title"><i class="anzhiyufont anzhiyu-icon-bilibili"></i><div class="ai-title-text">AI-摘要(由百度千帆大模型提供生成摘要能力)</div><i class="anzhiyufont anzhiyu-icon-arrow-rotate-right"></i><i class="anzhiyufont anzhiyu-icon-circle-dot" title="朗读摘要"></i><div id="ai-tag">Tianli GPT</div></div><div class="ai-explanation">AI初始化中...</div><div class="ai-btn-box"><div class="ai-btn-item" id="ccnone">介绍自己 🙈</div><div class="ai-btn-item">生成本文简介 👋</div><div class="ai-btn-item">推荐相关文章 📖</div><div class="ai-btn-item">前往主页 🏠</div><div class="ai-btn-item" id="go-tianli-blog">前往爱发电购买</div></div><script data-pjax src="/js/anzhiyu/ai_abstract.js"></script></div><article class="post-content" id="article-container" itemscope itemtype="https://ctext.top/c018.html"><header><a class="post-meta-categories" href="/categories/%E7%AC%94%E8%AE%B0/" itemprop="url">笔记</a><a href="/tags/docker/" tabindex="-1" itemprop="url">docker</a><h1 id="CrawlerTitle" itemprop="name headline">docker学习记录</h1><span itemprop="author" itemscope itemtype="http://schema.org/Person">伴随</span><time itemprop="dateCreated datePublished" datetime="2024-06-15T13:45:03.000Z" title="发表于 2024-06-15 21:45:03">2024-06-15</time><time itemprop="dateCreated datePublished" datetime="2024-06-15T13:45:03.000Z" title="更新于 2024-06-15 21:45:03">2024-06-15</time></header><h1>Docker</h1>
<h2 id="pmm">pmm</h2>
<figure class="highlight dockerfile"><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><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># admin</span></span><br><span class="line">docker <span class="keyword">run</span><span class="language-bash"> -d --name=pmm --restart=always \</span></span><br><span class="line"><span class="language-bash">-p 2812:2812 -p 2813:80 -p 2814:443 \</span></span><br><span class="line"><span class="language-bash">--privileged=<span class="literal">true</span> \</span></span><br><span class="line"><span class="language-bash">percona/pmm-server:latest</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># client</span></span><br><span class="line">docker <span class="keyword">run</span><span class="language-bash"> -d --net=pxc_network \</span></span><br><span class="line"><span class="language-bash">--name pmm-client \</span></span><br><span class="line"><span class="language-bash">-v /etc/localtime:/etc/localtime \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_SERVER_ADDRESS=10.252.110.188:2814 \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_SERVER_USERNAME=admin \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_SERVER_PASSWORD=admin \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_SERVER_INSECURE_TLS=1 \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_SETUP=1 \</span></span><br><span class="line"><span class="language-bash">-e PMM_AGENT_CONFIG_FILE=config/pmm-agent.yaml \</span></span><br><span class="line"><span class="language-bash">percona/pmm-client:latest </span></span><br><span class="line"></span><br><span class="line">pmm-admin <span class="keyword">add</span><span class="language-bash"> mysql --host=opalpxc3 --port=3306 --username=pmm --password=Mes_opal123 --service-name=pxc3</span></span><br><span class="line"></span><br><span class="line">在安装pmm-client客户端的主机上,添加监控的MySQL实例</span><br><span class="line"> </span><br><span class="line">pmm-admin <span class="keyword">add</span><span class="language-bash"> mysql --username=username --password=password --tls --tls-skip-verify --tls-ca=pathtoca.pem --tls-cert=pathtocert.pem --tls-key=pathtocertkey.pem --server-url=http://admin:admin@172.16.130.12 --query-source=perfschema name 172.16.130.53:3308</span></span><br><span class="line"></span><br><span class="line">pmm-admin <span class="keyword">add</span><span class="language-bash"> proxysql --host=10.252.110.183 --port=6033 --username=mes_opal --password=Mes_opal123 --service-name=proxysql</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">pmm-admin <span class="keyword">add</span><span class="language-bash"> mysql --query-source=perfschema --username=pmm --password=Mes_opal123 --service-name=client_pxc1 --host=10.252.110.180 --port=3306</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">docker exec -it pmm-client bash</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#查询存在的节点</span></span><br><span class="line">pmm-admin inventory list services --service-type=mysql</span><br></pre></td></tr></table></figure>
<h2 id="修改容器名">修改容器名</h2>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker rename pmm-server pmm-server-old</span><br></pre></td></tr></table></figure>
<h2 id="设置日志大小">设置日志大小</h2>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker update --log-opt max-size=<span class="number">20</span>m --log-opt max-file=<span class="number">30</span> <container-id></span><br></pre></td></tr></table></figure>
<h2 id="自动重启容器">自动重启容器</h2>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker update --restart=always 容器ID(或者容器名)</span><br></pre></td></tr></table></figure>
<h2 id="docker镜像命令">docker镜像命令</h2>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line">docker version #显示docker版本信息</span><br><span class="line">docker info #显示docker的系统信息</span><br><span class="line">docker 命令 --hepl #帮助命令</span><br><span class="line"></span><br><span class="line">docker images #查询当前容器中的镜像</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">搜索镜像</span></span><br><span class="line">docker search 软件名</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载镜像,默认下载最新版本---latest</span></span><br><span class="line">docker pull 软件名</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">指定版本下载</span></span><br><span class="line">docker pull 软件名:版本号(指定把版本号时必须保证dockhub中存在)</span><br><span class="line">https://hub.docker.com/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">删除镜像</span></span><br><span class="line">docker rmi -f 软件名或者id,多个用空格隔开</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">删除所有</span></span><br><span class="line">docker rmi -f $(docker images) </span><br></pre></td></tr></table></figure>
<h2 id="docker容器命令">docker容器命令</h2>
<figure class="highlight shell"><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><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载一个容器</span></span><br><span class="line">docker pull centos</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">启动一个容器</span></span><br><span class="line">docker run [参数] 容器名</span><br><span class="line"></span><br><span class="line">--name = "" #容器名称</span><br><span class="line">-d #后台运行</span><br><span class="line">-it #启动并且进入容器</span><br><span class="line">-p #指定端口</span><br><span class="line"> -p ip:主机端口:容器端口</span><br><span class="line"> -p 主机端口:容器端口</span><br><span class="line"> -p 容器端口</span><br><span class="line"> 不指定则随机端口</span><br><span class="line">--rm #用完即删,用于测试</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">运行nginx,指定名称为nginx1,后台方式运行,指定主机端口3344,容器端口80</span></span><br><span class="line">docker run -d --name nginx1 -p 3344:80 nginx</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">进入正在运行的容器</span></span><br><span class="line">docker exec -it 容器id #进入容器</span><br><span class="line">docker attach 容器id #进入容器正在执行的终端</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查询运行的容器</span></span><br><span class="line">docker ps []</span><br><span class="line"> -a #查询运行过的容器</span><br><span class="line"> -n = 1 #显示指定个数</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">退出容器</span></span><br><span class="line">exit #退出并且停止</span><br><span class="line">ctrl+p+q #退出不停止</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">删除容器</span></span><br><span class="line">docker rm 容器id或名称</span><br><span class="line"> -f #强制删除,无论是否运行</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看容器的占用情况</span></span><br><span class="line">docker stats 容器id</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">启动容器</span></span><br><span class="line">docker start 容器id</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">停止容器</span></span><br><span class="line">docker stop 容器id</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启容器</span></span><br><span class="line">docker restart 容器id</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">强制停止</span></span><br><span class="line">docker kill 容器id</span><br></pre></td></tr></table></figure>
<h2 id="查看日志">查看日志</h2>
<figure class="highlight shell"><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">docker logs [参数] 容器id</span><br><span class="line"> -ft #显示所有日志以及时间戳</span><br><span class="line"> --tail 10 #显示10行</span><br></pre></td></tr></table></figure>
<h2 id="查看容器中的进程">查看容器中的进程</h2>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker top 容器id</span><br></pre></td></tr></table></figure>
<h2 id="从容器内拷贝到主机">从容器内拷贝到主机</h2>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker cp 容器id:文件路径 主机路径</span><br></pre></td></tr></table></figure>
<h2 id="测试">测试</h2>
<figure class="highlight shell"><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 class="meta prompt_">#</span><span class="language-bash">安装nginx</span></span><br><span class="line">docker pull nginx</span><br></pre></td></tr></table></figure>
<h2 id="可视化-portsiner-文档">可视化(portsiner)<a target="_blank" rel="noopener" href="https://docs.portainer.io/start/install/agent/docker/linux">文档</a></h2>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">官方文档</span></span><br><span class="line">[文档](https://docs.portainer.io/start/install/agent/docker/linux)</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装命令</span></span><br><span class="line">docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest</span><br></pre></td></tr></table></figure>
<h2 id="commit镜像">commit镜像</h2>
<figure class="highlight shell"><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">docker commit -a cb e146099b156 tomcatcb:1.0</span><br><span class="line"> -a #提交作者名称</span><br><span class="line"> -m #提交的内容注释</span><br></pre></td></tr></table></figure>
<h2 id="容器数据卷">容器数据卷</h2>
<h3 id="指定路径挂载">指定路径挂载</h3>
<ul>
<li>将容器中的数据挂载到主机中,其实就是容器的持久化和同步</li>
</ul>
<figure class="highlight shell"><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 run -it -v 主机目录:容器目录</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">将tomcat的webapps目录挂载到主机中</span></span><br><span class="line">docker run -d -p 3344:8080 -v /root/tomcat/:/usr/local/tomcat/webapps tomcatcb:1.0</span><br></pre></td></tr></table></figure>
<h3 id="匿名挂载">匿名挂载</h3>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-v时不指定主机目录</span></span><br><span class="line">docker run -d -p 3344:8080 --name niming-tomcat -v /usr/local/tomcat/webapps tomcatcb:1.0</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看镜像配置</span></span><br><span class="line">docker inspect niming-tomcat</span><br><span class="line"></span><br><span class="line">"Mounts": [</span><br><span class="line"> {</span><br><span class="line"> "Type": "volume",</span><br><span class="line"> "Name": "9001da5b9732a3a17890977ed04e38eedf3db29573c606f674df2673f95b6d37",</span><br><span class="line"> "Source": </span><br><span class="line"> #这里目录为随机目录</span><br><span class="line">"/var/lib/docker/volumes/9001da5b9732a3a17890977ed04e38eedf3db29573c606f674df2673f95b6d37/_data", </span><br><span class="line"> "Destination": "/usr/local/tomcat/webapps",</span><br><span class="line"> "Driver": "local",</span><br><span class="line"> "Mode": "",</span><br><span class="line"> "RW": true,</span><br><span class="line"> "Propagation": ""</span><br><span class="line"> }</span><br><span class="line"> ]</span><br></pre></td></tr></table></figure>
<h3 id="具名挂载">具名挂载</h3>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-v时指定一个主机名称而不指定目录</span></span><br><span class="line">docker run -d --name jvanming-tomcat -p 3302:8080 -v jvanming-tomcat:/usr/local/tomcat/webapps tomcatcb:1.0</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看镜像配置</span></span><br><span class="line">docker inspect jvanming-tomcat</span><br><span class="line"></span><br><span class="line">"Mounts": [</span><br><span class="line"> {</span><br><span class="line"> "Type": "volume",</span><br><span class="line"> "Name": "jvanming-tomcat",</span><br><span class="line"> "Source": "/var/lib/docker/volumes/jvanming-tomcat/_data", #这里目录为我们指定的目录</span><br><span class="line"> "Destination": "/usr/local/tomcat/webapps",</span><br><span class="line"> "Driver": "local",</span><br><span class="line"> "Mode": "z",</span><br><span class="line"> "RW": true,</span><br><span class="line"> "Propagation": ""</span><br><span class="line"> }</span><br><span class="line"> ]</span><br></pre></td></tr></table></figure>
<h2 id="扩展">扩展</h2>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">还可以指定权限</span></span><br><span class="line">docker run -v jvming:/etc:[ro|rw]</span><br><span class="line"></span><br><span class="line">ro readOnly 只读</span><br><span class="line">rw readWrite 可读可写</span><br><span class="line">如果为只读那么容器中的配置文件无法修改,只能主机来修改</span><br></pre></td></tr></table></figure>
<h2 id="安装MySQL并且将数据文件挂载到主机中">安装MySQL并且将数据文件挂载到主机中</h2>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1.下载mysql</span></span><br><span class="line">docker pull mysql:8</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2.启动</span></span><br><span class="line">docker run -d -p 3308:3306 </span><br><span class="line">-v /root/dockerData/mysql/conf:/etc/mysql/conf.d #指定挂载目录,配置文件</span><br><span class="line">-v /root/dockerData/mysql/data:/var/lib/mysql #指定挂载目录,数据库文件</span><br><span class="line">-e MYSQL_ROOT_PASSWORD=123456 #指定连接密码</span><br><span class="line">--name mysql01 mysql:8 #指定版本</span><br></pre></td></tr></table></figure>
<h2 id="DockerFile">DockerFile</h2>
<figure class="highlight shell"><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">FROM # 基础镜像</span><br><span class="line">MAINTAINER # 指定镜像作者</span><br><span class="line">RUN # 镜像构建是需要运行的命令</span><br><span class="line">ADD # 添加内容</span><br><span class="line">WORDDIR # 镜像工作目录</span><br><span class="line">VOLOME # 挂载的目录</span><br><span class="line">EXPOSE # 端口</span><br><span class="line">ONBUILD # 继承镜像时执行该命令</span><br><span class="line">COPY # 类似add。将文件拷贝到镜像中</span><br><span class="line">ENV # 设置环境变量</span><br></pre></td></tr></table></figure>
<h2 id="配置tomcat环境的DockerFile脚本">配置tomcat环境的DockerFile脚本</h2>
<figure class="highlight shell"><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><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1. 编写dockerfile脚本</span></span><br><span class="line">from centos:8 #初始容器centos8</span><br><span class="line"></span><br><span class="line">maintainer chenbo #作者名称</span><br><span class="line"></span><br><span class="line">copy readme.txt /usr/local/ #拷贝文件</span><br><span class="line"></span><br><span class="line">add apache-tomcat-8.5.79.tar.gz /usr/local #添加依赖</span><br><span class="line">add jdk-8u333-linux-x64.tar.gz /usr/local #添加依赖</span><br><span class="line"></span><br><span class="line">workdir /usr/local #工作目录</span><br><span class="line"></span><br><span class="line">env JAVA_HOME /usr/local/jdk1.8.0_333 #配置环境变量</span><br><span class="line">env CLASSPATH $JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib</span><br><span class="line"></span><br><span class="line">env CATALINA_HOME /usr/local/apache-tomcat-8.5.79</span><br><span class="line">env CATALINA_BASH /usr/local/apache-tomcat-8.5.79</span><br><span class="line"></span><br><span class="line">env PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_BASH/bin</span><br><span class="line"></span><br><span class="line">expose 8080 #端口</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">启动tomcat脚本</span></span><br><span class="line">cmd /usr/local/apache-tomcat-8.5.79/bin/startup.sh && tail -F /usr/local/apache-tomcat-8.5.79/logs/log.out</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2.编译脚本文件</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-t指定镜像名称和版本 -f指定脚本文件 .指定当前目录</span></span><br><span class="line">docker build -t mytomcat-diy:1.0 -f my-tomcat-test .</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动镜像</span></span><br><span class="line">docker run -d -p 8080:8080 --name chenbotomcatdiy -v /root/dockerData/my-tomcat/jar/:/usr/local/apache-tomcat-8.5.79/webapps/test -v /root/dockerData/my-tomcat/logs:/usr/local/apache-tomcat-8.5.79/logs -it mytomcat-diy:1.0</span><br></pre></td></tr></table></figure>
<h2 id="提交到远程仓库">提交到远程仓库</h2>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker </span><br></pre></td></tr></table></figure>
<h2 id="docker-compose">docker-compose</h2>
<ul>
<li>容器编排技术</li>
</ul>
<h3 id="compose相关命令">compose相关命令</h3>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看当前正在运行的项目</span></span><br><span class="line">docker-compose ps</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建并启动容器</span></span><br><span class="line">docker-compose up</span><br><span class="line"> -f #指定docker-compose文件位置,不指定默认当前位置</span><br><span class="line"> -p #指定项目名称,默认目录名</span><br><span class="line"> -d #后台运行</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">构建容器</span></span><br><span class="line">docker-compose build</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止</span></span><br><span class="line">docker-compose down</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">验证并查看 Compose 文件,有错误时会提示行号</span></span><br><span class="line">docker-compose config </span><br></pre></td></tr></table></figure>
<figure class="highlight yaml"><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><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">version:</span> <span class="string">"3"</span></span><br><span class="line"><span class="attr">services:</span></span><br><span class="line"> <span class="attr">nginx:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">nginx:1.21.6</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"8022:80"</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/nginx/nginx.conf:/etc/nginx/nginx.conf"</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">rabbitmq:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">rabbitmq:3.10.2-management</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"5672:5672"</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"15672:15672"</span></span><br><span class="line"> <span class="attr">environment:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RABBITMQ_DEFAULT_USER:guest</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RABBITMQ_DEFAULT_PASS:guest</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">loopback_users:none</span> <span class="comment">#远程访问</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf"</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">redis:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">redis:7.0.0</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"6381:6379"</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/redis/redis.conf:/usr/local/etc/redis/redis.conf"</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/redis/data:/data"</span></span><br><span class="line"> <span class="attr">environment:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">“appendonly=yes”</span> <span class="comment">#数据持久化</span></span><br><span class="line"> <span class="attr">command:</span></span><br><span class="line"> <span class="string">--requirepass</span> <span class="string">"123456"</span> <span class="comment">#这一行是设置密码</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">mysql:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">mysql:8</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"3307:3306"</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/mysql/conf.d:/etc/mysql/conf.d"</span> <span class="comment">#指定挂载目录,配置文件</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/mysql/data:/var/lib/mysql"</span> <span class="comment">#指定挂载目录,数据库文件</span></span><br><span class="line"> <span class="attr">environment:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">MYSQL_ROOT_PASSWORD:"123456"</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">jar:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">chendd1314/getwebdata-dockerfile:1.0</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"/docker-project-data/jar/log/:/log/"</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"9091:9091"</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">centos:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">c</span></span><br></pre></td></tr></table></figure>
<h2 id="镜像和容器的导入导出">镜像和容器的导入导出</h2>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">导出</span></span><br><span class="line">docker save -o 指定路径 指定镜像名称</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">导入</span></span><br><span class="line">docker load -i 镜像路径</span><br></pre></td></tr></table></figure>
<p>==容器导入导出==</p>
<figure class="highlight shell"><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></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">导出</span></span><br><span class="line">docker export -o 文件全路径 镜像名称</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">导入</span></span><br><span class="line">docker import 文件全路径</span><br></pre></td></tr></table></figure>
<blockquote>
<p>导出是文件后缀为tar</p>
<p>save保存的是镜像,export保存的是容器<br>
load用来载入镜像包,import用来载入容器包,但两者都会恢复为镜像<br>
load不能对载入的镜像重命名,而import可以为镜像指定新名称<br>
load不能载入容器包,import能载入镜像包,但不能使用</p>
</blockquote>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --name xxl-job-admin -d -p 8090:8090 -v /home/datadisk/xxl-job-admin/config/application.properties:/application.properties -v /home/datadisk/xxl-job-admin/log:/data/applogs xuxueli/xxl-job-admin </span><br></pre></td></tr></table></figure></article><div class="post-copyright"><div class="copyright-cc-box"><i class="anzhiyufont anzhiyu-icon-copyright"></i></div><div class="post-copyright__author_box"><a class="post-copyright__author_img" href="/" title="头像"><img class="post-copyright__author_img_back" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/avatar.png" title="头像" alt="头像"><img class="post-copyright__author_img_front" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/avatar.png" title="头像" alt="头像"></a><div class="post-copyright__author_name">伴随</div><div class="post-copyright__author_desc">请保持那份热爱 奔赴下一场山海</div></div><div class="post-copyright__post__info"><a class="post-copyright__original" title="该文章为原创文章,注意版权协议" href="https://ctext.top/c018.html">原创</a><a class="post-copyright-title"><span onclick="rm.copyPageUrl('https://ctext.top/c018.html')">docker学习记录</span></a></div><div class="post-tools" id="post-tools"><div class="post-tools-left"><div class="rewardLeftButton"><div class="post-reward" onclick="anzhiyu.addRewardMask()"><div class="reward-button button--animated" title="赞赏作者"><i class="anzhiyufont anzhiyu-icon-hand-heart-fill"></i>打赏作者</div><div class="reward-main"><div class="reward-all"><span class="reward-title">感谢你赐予我前进的力量</span><ul class="reward-group"><li class="reward-item"><a href="https://up.ctext.top/pay/wx.png" target="_blank"><img class="post-qr-code-img" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/pay/wx.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://up.ctext.top/pay/zfb.png" target="_blank"><img class="post-qr-code-img" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/pay/zfb.png" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul><a class="reward-main-btn" href="/about/#about-reward" target="_blank"><div class="reward-text">赞赏者名单</div><div class="reward-dec">因为你们的支持让我意识到写文章的价值🙏</div></a></div></div></div><div id="quit-box" onclick="anzhiyu.removeRewardMask()" style="display: none"></div></div><div class="shareRight"><div class="share-link mobile"><div class="share-qrcode"><div class="share-button" title="使用手机访问这篇文章"><i class="anzhiyufont anzhiyu-icon-qrcode"></i></div><div class="share-main"><div class="share-main-all"><div id="qrcode" title="https://ctext.top/c018.html"></div><div class="reward-dec">使用手机访问这篇文章</div></div></div></div></div><div class="share-link weibo"><a class="share-button" target="_blank" href="https://service.weibo.com/share/share.php?title=docker学习记录&url=https://ctext.top/c018.html&pic=https://up.ctext.top/article/2024/06/docker.png" rel="external nofollow noreferrer noopener"><i class="anzhiyufont anzhiyu-icon-weibo"></i></a></div><script>function copyCurrentPageUrl() {
var currentPageUrl = window.location.href;
var input = document.createElement("input");
input.setAttribute("value", currentPageUrl);
document.body.appendChild(input);
input.select();
input.setSelectionRange(0, 99999);
document.execCommand("copy");
document.body.removeChild(input);
}</script><div class="share-link copyurl"><div class="share-button" id="post-share-url" title="复制链接" onclick="copyCurrentPageUrl()"><i class="anzhiyufont anzhiyu-icon-link"></i></div></div></div></div></div><div class="post-copyright__notice"><span class="post-copyright-info">本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://ctext.top" target="_blank">伴随的小站</a>!</span></div></div><div class="post-tools-right"><div class="tag_share"><div class="post-meta__box"><div class="post-meta__box__category-list"><a class="post-meta__box__categoryes" href="/categories/%E7%AC%94%E8%AE%B0/"><span class="categoryes-punctuation"> <i class="anzhiyufont anzhiyu-icon-inbox"></i></span>笔记<span class="categoryesPageCount">3</span></a></div><div class="post-meta__box__tag-list"><a class="post-meta__box__tags" href="/tags/docker/"><span class="tags-punctuation"> <i class="anzhiyufont anzhiyu-icon-tag"></i></span>docker<span class="tagsPageCount">1</span></a></div></div><div class="post_share"><div class="social-share" data-image="https://up.ctext.top/article/2024/11/tools3.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.cbd.int/butterfly-extsrc@1.1.3/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"/><script src="https://cdn.cbd.int/butterfly-extsrc@1.1.3/sharejs/dist/js/social-share.min.js" defer="defer"></script></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/4814.html"><img class="prev-cover" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/06/knowledge.png" onerror="onerror=null;src='https://up.ctext.top/default_bg.png'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">常用知识总结</div></div></a></div><div class="next-post pull-right"><a href="/77f2.html"><img class="next-cover" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/06/symbol.png" onerror="onerror=null;src='https://up.ctext.top/default_bg.png'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">好玩的图案分享</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="anzhiyufont anzhiyu-icon-comments"></i><span> 评论</span></div><div class="comment-randomInfo"><a onclick="anzhiyu.addRandomCommentInfo()" href="javascript:void(0)" style="display: none">匿名评论</a><a href="/privacy" style="margin-left: 4px">隐私政策</a></div></div><div class="comment-wrap"><div><div id="waline-wrap"></div></div></div></div><div class="comment-barrage"></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-content"><div class="author-info__sayhi" id="author-info__sayhi" onclick="anzhiyu.changeSayHelloText()"></div><div class="author-info-avatar"><img class="avatar-img" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/avatar.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-status"><img class="g-status" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://bu.dusays.com/2023/08/24/64e6ce9c507bb.png" alt="status"/></div></div><div class="author-info__description"><div style="line-height:1.38;margin:0.6rem 0;text-align:center;color:rgba(255, 255, 255, 0.8);"> <b style="color:#fff">我想,左肩有你,右肩微笑</b> </div> <div style="line-height:1.38;margin:0.6rem 0;text-align:center;color:rgba(255, 255, 255, 0.8);"> <b style="color:#fff">我想,在你眼里,撒野奔跑</b> </div> <div style="line-height:1.38;margin:0.6rem 0;text-align:center;color:rgba(255, 255, 255, 0.8);"> <b style="color:#fff">我想,一个眼神,就到老 </b> </div> <div style="line-height:1.38;margin:0.6rem 0;text-align:center;color:rgba(255, 255, 255, 0.8);"> <b style="color:#fff">我想………        </b> </div></div><div class="author-info__bottom-group"><a class="author-info__bottom-group-left" href="/"><h1 class="author-info__name">伴随</h1><div class="author-info__desc">请保持那份热爱 奔赴下一场山海</div></a><div class="card-info-social-icons is-center"><a class="social-icon faa-parent animated-hover" href="https://qm.qq.com/q/1sv8urqpRS" target="_blank" title="QQ"><i class="anzhiyufont anzhiyu-icon-qq"></i></a></div></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-bullhorn anzhiyu-shake"></i><span>公告</span></div><div class="announcement_content"><div id="welcome-info"></div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-bars"></i><span>文章目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">1.</span> <span class="toc-text">Docker</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#pmm"><span class="toc-number">1.1.</span> <span class="toc-text">pmm</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E5%AE%B9%E5%99%A8%E5%90%8D"><span class="toc-number">1.2.</span> <span class="toc-text">修改容器名</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%97%A5%E5%BF%97%E5%A4%A7%E5%B0%8F"><span class="toc-number">1.3.</span> <span class="toc-text">设置日志大小</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%87%AA%E5%8A%A8%E9%87%8D%E5%90%AF%E5%AE%B9%E5%99%A8"><span class="toc-number">1.4.</span> <span class="toc-text">自动重启容器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#docker%E9%95%9C%E5%83%8F%E5%91%BD%E4%BB%A4"><span class="toc-number">1.5.</span> <span class="toc-text">docker镜像命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#docker%E5%AE%B9%E5%99%A8%E5%91%BD%E4%BB%A4"><span class="toc-number">1.6.</span> <span class="toc-text">docker容器命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%BF%97"><span class="toc-number">1.7.</span> <span class="toc-text">查看日志</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E5%AE%B9%E5%99%A8%E4%B8%AD%E7%9A%84%E8%BF%9B%E7%A8%8B"><span class="toc-number">1.8.</span> <span class="toc-text">查看容器中的进程</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BB%8E%E5%AE%B9%E5%99%A8%E5%86%85%E6%8B%B7%E8%B4%9D%E5%88%B0%E4%B8%BB%E6%9C%BA"><span class="toc-number">1.9.</span> <span class="toc-text">从容器内拷贝到主机</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95"><span class="toc-number">1.10.</span> <span class="toc-text">测试</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%AF%E8%A7%86%E5%8C%96-portsiner-%E6%96%87%E6%A1%A3"><span class="toc-number">1.11.</span> <span class="toc-text">可视化(portsiner)文档</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#commit%E9%95%9C%E5%83%8F"><span class="toc-number">1.12.</span> <span class="toc-text">commit镜像</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%B9%E5%99%A8%E6%95%B0%E6%8D%AE%E5%8D%B7"><span class="toc-number">1.13.</span> <span class="toc-text">容器数据卷</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8C%87%E5%AE%9A%E8%B7%AF%E5%BE%84%E6%8C%82%E8%BD%BD"><span class="toc-number">1.13.1.</span> <span class="toc-text">指定路径挂载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8C%BF%E5%90%8D%E6%8C%82%E8%BD%BD"><span class="toc-number">1.13.2.</span> <span class="toc-text">匿名挂载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%B7%E5%90%8D%E6%8C%82%E8%BD%BD"><span class="toc-number">1.13.3.</span> <span class="toc-text">具名挂载</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%A9%E5%B1%95"><span class="toc-number">1.14.</span> <span class="toc-text">扩展</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85MySQL%E5%B9%B6%E4%B8%94%E5%B0%86%E6%95%B0%E6%8D%AE%E6%96%87%E4%BB%B6%E6%8C%82%E8%BD%BD%E5%88%B0%E4%B8%BB%E6%9C%BA%E4%B8%AD"><span class="toc-number">1.15.</span> <span class="toc-text">安装MySQL并且将数据文件挂载到主机中</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#DockerFile"><span class="toc-number">1.16.</span> <span class="toc-text">DockerFile</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEtomcat%E7%8E%AF%E5%A2%83%E7%9A%84DockerFile%E8%84%9A%E6%9C%AC"><span class="toc-number">1.17.</span> <span class="toc-text">配置tomcat环境的DockerFile脚本</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8F%90%E4%BA%A4%E5%88%B0%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93"><span class="toc-number">1.18.</span> <span class="toc-text">提交到远程仓库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#docker-compose"><span class="toc-number">1.19.</span> <span class="toc-text">docker-compose</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#compose%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4"><span class="toc-number">1.19.1.</span> <span class="toc-text">compose相关命令</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%95%9C%E5%83%8F%E5%92%8C%E5%AE%B9%E5%99%A8%E7%9A%84%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA"><span class="toc-number">1.20.</span> <span class="toc-text">镜像和容器的导入导出</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-history"></i><span>最近发布</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/8a0c.html" title="JAVA表达式解析器———EvalEx"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/11/tools3.png" onerror="this.onerror=null;this.src='https://up.ctext.top/default_bg.png'" alt="JAVA表达式解析器———EvalEx"/></a><div class="content"><a class="title" href="/8a0c.html" title="JAVA表达式解析器———EvalEx">JAVA表达式解析器———EvalEx</a><time datetime="2024-11-17T06:10:54.000Z" title="发表于 2024-11-17 14:10:54">2024-11-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/dfd4.html" title="IDEA快捷键大全"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/10/idea.png" onerror="this.onerror=null;this.src='https://up.ctext.top/default_bg.png'" alt="IDEA快捷键大全"/></a><div class="content"><a class="title" href="/dfd4.html" title="IDEA快捷键大全">IDEA快捷键大全</a><time datetime="2024-10-15T12:08:03.000Z" title="发表于 2024-10-15 20:08:03">2024-10-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/51a7.html" title="java随机数介绍以及生成随机日期"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/10/tools2.png" onerror="this.onerror=null;this.src='https://up.ctext.top/default_bg.png'" alt="java随机数介绍以及生成随机日期"/></a><div class="content"><a class="title" href="/51a7.html" title="java随机数介绍以及生成随机日期">java随机数介绍以及生成随机日期</a><time datetime="2024-10-14T12:16:33.000Z" title="发表于 2024-10-14 20:16:33">2024-10-14</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/3329.html" title="JAVA工具类(一)——生成班次排班记录"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/08/tools1.png" onerror="this.onerror=null;this.src='https://up.ctext.top/default_bg.png'" alt="JAVA工具类(一)——生成班次排班记录"/></a><div class="content"><a class="title" href="/3329.html" title="JAVA工具类(一)——生成班次排班记录">JAVA工具类(一)——生成班次排班记录</a><time datetime="2024-08-15T12:34:41.000Z" title="发表于 2024-08-15 20:34:41">2024-08-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/43a1.html" title="Feign调用者如何配置全局Header参数?"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/article/2024/08/feign.png" onerror="this.onerror=null;this.src='https://up.ctext.top/default_bg.png'" alt="Feign调用者如何配置全局Header参数?"/></a><div class="content"><a class="title" href="/43a1.html" title="Feign调用者如何配置全局Header参数?">Feign调用者如何配置全局Header参数?</a><time datetime="2024-08-12T11:39:34.000Z" title="发表于 2024-08-12 19:39:34">2024-08-12</time></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div id="workboard"><img class="workSituationImg boardsign" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/happy.svg" alt="下班了就该开开心心的玩耍,嘿嘿~" title="下班了就该开开心心的玩耍,嘿嘿~"/><div id="runtimeTextTip"></div></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px" data-title="博客框架为Hexo_v7.2.0" title="博客框架为Hexo_v7.2.0"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/hexo.svg" alt="博客框架为Hexo_v7.2.0"/></a><a class="github-badge" target="_blank" href="https://docs.anheyu.com/" style="margin-inline:5px" data-title="本站使用AnZhiYu主题" title="本站使用AnZhiYu主题"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/anzhiyu.svg" alt="本站使用AnZhiYu主题"/></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px" data-title="本站使用Vercel部署" title="本站使用Vercel部署"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/vercel.svg" alt="本站使用Vercel部署"/></a><a class="github-badge" target="_blank" href="https://github.com/" style="margin-inline:5px" data-title="本站项目源码由Github托管" title="本站项目源码由Github托管"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/github.svg" alt="本站项目源码由Github托管"/></a><a class="github-badge" target="_blank" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" style="margin-inline:5px" data-title="本站项目由又拍云提供CDN加速/云存储服务" title="本站项目由又拍云提供CDN加速/云存储服务"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/up.svg" alt="本站项目由又拍云提供CDN加速/云存储服务"/></a><a class="github-badge" target="_blank" href="https://github.com/walinejs/waline" style="margin-inline:5px" data-title="本站评论系统使用Waline搭建" title="本站评论系统使用Waline搭建"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/svg/waline.svg" alt="本站评论系统使用Waline搭建"/></a></p></div><div id="footer-bar"><div class="footer-bar-links"><div class="footer-bar-left"><div id="footer-bar-tips"><div class="copyright">©2024 - 2025 By <a class="footer-bar-link" href="/" title="伴随" target="_blank">伴随</a></div></div><div id="footer-type-tips"></div><div class="js-pjax"><script>function subtitleType () {
getScript('https://yijuzhan.com/api/word.php?m=js').then(() => {
const con = str[0]
if (true) {
const from = '出自 ' + str[1]
const sub = []
sub.unshift(con, from)
window.typed = new Typed('#footer-type-tips', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: true,
backSpeed: 50,
})
} else {
document.getElementById('footer-type-tips').innerHTML = con
}
})
}
if (true) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('https://cdn.cbd.int/typed.js@2.1.0/dist/typed.umd.js').then(subtitleType)
}
} else {
subtitleType()
}
</script></div></div><div class="footer-bar-right"><a class="footer-bar-link" target="_blank" rel="noopener" href="https://beian.miit.gov.cn/" title="京ICP备2022017849号-2">京ICP备2022017849号-2</a></div></div></div></footer></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="sidebar-site-data site-data is-center"><a href="/archives/" title="archive"><div class="headline">文章</div><div class="length-num">23</div></a><a href="/tags/" title="tag"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/" title="category"><div class="headline">分类</div><div class="length-num">6</div></a></div><span class="sidebar-menu-item-title">功能</span><div class="sidebar-menu-item"><a class="darkmode_switchbutton menu-child" href="javascript:void(0);" title="显示模式"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i><span>显示模式</span></a></div><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">关于</div><div class="back-menu-list"><a class="back-menu-item" href="/about/" title="我"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/orange.svg" alt="我"/><span class="back-menu-item-text">我</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">博客</div><div class="back-menu-list"><a class="back-menu-item" href="/album/" title="我的相册"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/strawberry.svg" alt="我的相册"/><span class="back-menu-item-text">我的相册</span></a><a class="back-menu-item" href="/essay/" title="记录生活"><img class="back-menu-item-icon" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" onerror="this.onerror=null,this.src="https://up.ctext.top/default_bg.png"" data-lazy-src="https://up.ctext.top/ico/apple.svg" alt="记录生活"/><span class="back-menu-item-text">记录生活</span></a></div></div></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 文章</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/"><i class="anzhiyufont anzhiyu-icon-grip-vertical faa-tada" style="font-size: 0.9em;"></i><span> 主页</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/archives/"><i class="anzhiyufont anzhiyu-icon-box-archive faa-tada" style="font-size: 0.9em;"></i><span> 总览</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><i class="anzhiyufont anzhiyu-icon-shapes faa-tada" style="font-size: 0.9em;"></i><span> 分类</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><i class="anzhiyufont anzhiyu-icon-tags faa-tada" style="font-size: 0.9em;"></i><span> 标签</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 我的</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/growth.html"><i class="anzhiyufont anzhiyu-icon-heartbeat faa-tada" style="font-size: 0.9em;"></i><span> 博客岁月</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/music/"><i class="anzhiyufont anzhiyu-icon-music faa-tada" style="font-size: 0.9em;"></i><span> 音乐馆</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/"><i class="anzhiyufont anzhiyu-icon-images faa-tada" style="font-size: 0.9em;"></i><span> 相册集</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/essay/"><i class="anzhiyufont anzhiyu-icon-lightbulb faa-tada" style="font-size: 0.9em;"></i><span> 记录生活</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 小工具</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/air-conditioner/"><i class="anzhiyufont anzhiyu-icon-fan faa-tada" style="font-size: 0.9em;"></i><span> 小空调</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/gradation/"><i class="anzhiyufont anzhiyu-icon-envelope faa-tada" style="font-size: 0.9em;"></i><span> 渐变背景生成</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/9abe.html"><i class="anzhiyufont anzhiyu-icon-artstation faa-tada" style="font-size: 0.9em;"></i><span> tag-plugins文档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/nav"><i class="anzhiyufont anzhiyu-icon-link faa-tada" style="font-size: 0.9em;"></i><span> 网址导航</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://map.ctext.top"><i class="anzhiyufont anzhiyu-icon-keyboard faa-tada" style="font-size: 0.9em;"></i><span> 飞车随机选图工具</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span> 关于</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/about/"><i class="anzhiyufont anzhiyu-icon-paper-plane faa-tada" style="font-size: 0.9em;"></i><span> 关于自己</span></a></li><li><a class="site-page child faa-parent animated-hover" href="javascript:toRandomPost()"><i class="anzhiyufont anzhiyu-icon-shoe-prints1 faa-tada" style="font-size: 0.9em;"></i><span> 随便逛逛</span></a></li></ul></div></div><span class="sidebar-menu-item-title">标签</span><div class="card-tags"><div class="item-headline"></div><div class="card-tag-cloud"><a href="/tags/Feign/" style="font-size: 0.88rem;">Feign<sup>1</sup></a><a href="/tags/IDEA/" style="font-size: 0.88rem;">IDEA<sup>1</sup></a><a href="/tags/JAVA/" style="font-size: 0.88rem;">JAVA<sup>5</sup></a><a href="/tags/Waline/" style="font-size: 0.88rem;">Waline<sup>1</sup></a><a href="/tags/docker/" style="font-size: 0.88rem;">docker<sup>1</sup></a><a href="/tags/hexo/" style="font-size: 0.88rem;">hexo<sup>4</sup></a><a href="/tags/java/" style="font-size: 0.88rem;">java<sup>1</sup></a><a href="/tags/linux/" style="font-size: 0.88rem;">linux<sup>2</sup></a><a href="/tags/logback/" style="font-size: 0.88rem;">logback<sup>1</sup></a><a href="/tags/nacos/" style="font-size: 0.88rem;">nacos<sup>1</sup></a><a href="/tags/window/" style="font-size: 0.88rem;">window<sup>1</sup></a><a href="/tags/%E4%BA%8C%E8%BF%9B%E5%88%B6/" style="font-size: 0.88rem;">二进制<sup>1</sup></a><a href="/tags/%E5%B7%A5%E5%85%B7%E7%B1%BB/" style="font-size: 0.88rem;">工具类<sup>3</sup></a><a href="/tags/%E5%BE%AE%E4%BF%A1/" style="font-size: 0.88rem;">微信<sup>1</sup></a><a href="/tags/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/" style="font-size: 0.88rem;">排序算法<sup>1</sup></a><a href="/tags/%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E/" style="font-size: 0.88rem;">搜索引擎<sup>1</sup></a><a href="/tags/%E7%AC%A6%E5%8F%B7%E7%9A%84%E8%89%BA%E6%9C%AF/" style="font-size: 0.88rem;">符号的艺术<sup>1</sup></a><a href="/tags/%E8%84%9A%E6%9C%AC/" style="font-size: 0.88rem;">脚本<sup>2</sup></a><a href="/tags/%E8%BD%AF%E4%BB%B6%E8%AE%BE%E8%AE%A1%E5%B8%88/" style="font-size: 0.88rem;">软件设计师<sup>5</sup></a><a href="/tags/%E8%BD%AF%E8%80%83/" style="font-size: 0.88rem;">软考<sup>3</sup></a><a href="/tags/%E8%BE%BE%E6%A2%A6%E6%95%B0%E6%8D%AE%E5%BA%93/" style="font-size: 0.88rem;">达梦数据库<sup>1</sup></a></div></div><hr/></div></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="anzhiyufont anzhiyu-icon-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="anzhiyufont anzhiyu-icon-arrows-left-right"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="anzhiyufont anzhiyu-icon-gear"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="anzhiyufont anzhiyu-icon-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="anzhiyufont anzhiyu-icon-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i></button></div></div><div id="nav-music"><a id="nav-music-hoverTips" onclick="anzhiyu.musicToggle()" accesskey="m">播放音乐</a><div id="console-music-bg"></div><meting-js id="2788494248" server="netease" type="playlist" mutex="true" preload="none" theme="var(--anzhiyu-main)" data-lrctype="0" order="random" volume="0.7"></meting-js></div><div id="rightMenu"><div class="rightMenu-group rightMenu-small"><div class="rightMenu-item" id="menu-backward"><i class="anzhiyufont anzhiyu-icon-arrow-left"></i></div><div class="rightMenu-item" id="menu-forward"><i class="anzhiyufont anzhiyu-icon-arrow-right"></i></div><div class="rightMenu-item" id="menu-refresh"><i class="anzhiyufont anzhiyu-icon-arrow-rotate-right" style="font-size: 1rem;"></i></div><div class="rightMenu-item" id="menu-top"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i></div></div><div class="rightMenu-group rightMenu-line rightMenuPlugin"><div class="rightMenu-item" id="menu-copytext"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制选中文本</span></div><div class="rightMenu-item" id="menu-pastetext"><i class="anzhiyufont anzhiyu-icon-paste"></i><span>粘贴文本</span></div><a class="rightMenu-item" id="menu-commenttext"><i class="anzhiyufont anzhiyu-icon-comment-medical"></i><span>引用到评论</span></a><div class="rightMenu-item" id="menu-newwindow"><i class="anzhiyufont anzhiyu-icon-window-restore"></i><span>新窗口打开</span></div><div class="rightMenu-item" id="menu-copylink"><i class="anzhiyufont anzhiyu-icon-link"></i><span>复制链接地址</span></div><div class="rightMenu-item" id="menu-copyimg"><i class="anzhiyufont anzhiyu-icon-images"></i><span>复制此图片</span></div><div class="rightMenu-item" id="menu-downloadimg"><i class="anzhiyufont anzhiyu-icon-download"></i><span>下载此图片</span></div><div class="rightMenu-item" id="menu-newwindowimg"><i class="anzhiyufont anzhiyu-icon-window-restore"></i><span>新窗口打开图片</span></div><div class="rightMenu-item" id="menu-search"><i class="anzhiyufont anzhiyu-icon-magnifying-glass"></i><span>站内搜索</span></div><div class="rightMenu-item" id="menu-searchBaidu"><i class="anzhiyufont anzhiyu-icon-magnifying-glass"></i><span>百度搜索</span></div><div class="rightMenu-item" id="menu-music-toggle"><i class="anzhiyufont anzhiyu-icon-play"></i><span>播放音乐</span></div><div class="rightMenu-item" id="menu-music-back"><i class="anzhiyufont anzhiyu-icon-backward"></i><span>切换到上一首</span></div><div class="rightMenu-item" id="menu-music-forward"><i class="anzhiyufont anzhiyu-icon-forward"></i><span>切换到下一首</span></div><div class="rightMenu-item" id="menu-music-playlist" onclick="window.open("https://music.163.com/#/playlist?id=2788494248", "_blank");" style="display: none;"><i class="anzhiyufont anzhiyu-icon-radio"></i><span>查看所有歌曲</span></div><div class="rightMenu-item" id="menu-music-copyMusicName"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制歌名</span></div></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item menu-link" id="menu-randomPost"><i class="anzhiyufont anzhiyu-icon-shuffle"></i><span>随便逛逛</span></a><a class="rightMenu-item menu-link" href="/categories/"><i class="anzhiyufont anzhiyu-icon-cube"></i><span>博客分类</span></a><a class="rightMenu-item menu-link" href="/tags/"><i class="anzhiyufont anzhiyu-icon-tags"></i><span>文章标签</span></a></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item" id="menu-copy" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制地址</span></a><a class="rightMenu-item" id="menu-commentBarrage" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-message"></i><span class="menu-commentBarrage-text">关闭热评</span></a><a class="rightMenu-item" id="menu-darkmode" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i><span class="menu-darkmode-text">深色模式</span></a><a class="rightMenu-item" id="menu-translate" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-language"></i><span>轉為繁體</span></a></div></div><div id="rightmenu-mask"></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.cbd.int/@fancyapps/ui@5.0.28/dist/fancybox/fancybox.umd.js"></script><script src="https://cdn.cbd.int/instant.page@5.2.0/instantpage.js" type="module"></script><script src="https://cdn.cbd.int/vanilla-lazyload@17.8.5/dist/lazyload.iife.min.js"></script><script src="https://cdn.cbd.int/node-snackbar@0.1.16/dist/snackbar.min.js"></script><script>function panguFn () {
if (typeof pangu === 'object') pangu.autoSpacingPage()
else {
getScript('https://cdn.cbd.int/pangu@4.0.7/dist/browser/pangu.min.js')
.then(() => {
pangu.autoSpacingPage()
})
}
}
function panguInit () {
if (false){
GLOBAL_CONFIG_SITE.isPost && panguFn()
} else {
panguFn()
}
}
document.addEventListener('DOMContentLoaded', panguInit)</script><canvas id="universe"></canvas><script async src="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.0/dark/dark.js"></script><script async src="/anzhiyu/random.js"></script><script async="async">(function () {
var grt = new Date("01/02/2024 00:00:00"); //设置网站上线时间
var now = new Date();
var dnum;
var hnum;
var mnum;
var snum;
var nowHour;
// 计算并更新天数、小时数、分钟数和秒数
function updateTime() {
now = new Date(); // 更新 now 的值
nowHour = now.getHours(); // 更新 nowHour 的值
var days = (now - grt) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
var hours = (now - grt) / 1000 / 60 / 60 - 24 * dnum;
hnum = Math.floor(hours);
if (String(hnum).length == 1) {
hnum = "0" + hnum;
}
var minutes = (now - grt) / 1000 / 60 - 24 * 60 * dnum - 60 * hnum;
mnum = Math.floor(minutes);
if (String(mnum).length == 1) {
mnum = "0" + mnum;
}
var seconds = (now - grt) / 1000 - 24 * 60 * 60 * dnum - 60 * 60 * hnum - 60 * mnum;
snum = Math.round(seconds);
if (String(snum).length == 1) {
snum = "0" + snum;
}
}
// 更新网页中显示的网站运行时间
function updateHtml() {
const footer = document.getElementById("footer");
if (!footer) return
let currentTimeHtml = "";
if (nowHour < 18 && nowHour >= 9) {
// 如果是上班时间,默认就是"安知鱼-上班摸鱼中.svg"图片,不需要更改
currentTimeHtml = `本站居然运行了 ${dnum} 天<span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span><i class='anzhiyufont anzhiyu-icon-heartbeat' style='color:red'></i>`;
} else {
// 如果是下班时间,插入"安知鱼-下班啦.svg"图片
let img = document.querySelector("#workboard .workSituationImg");
if (img != null) {
img.src = "https://up.ctext.top/happy.svg";
img.title = "下班了就该开开心心的玩耍,嘿嘿~";
img.alt = "下班了就该开开心心的玩耍,嘿嘿~";
}
currentTimeHtml = `本站居然运行了 ${dnum} 天<span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span><i class='anzhiyufont anzhiyu-icon-heartbeat' style='color:red'></i>`;
}
if (document.getElementById("runtimeTextTip")) {
document.getElementById("runtimeTextTip").innerHTML = currentTimeHtml;
}
}
setInterval(() => {
updateTime();
updateHtml();
}, 1000);
})();</script><div class="js-pjax"><script>(() => {
const locale = {
nick: '你的专属昵称',
nickError: '昵称太短啦!至少得有3个字符才能算数哦!',
mail: '你的电子小信箱',
mailError: '哎呀,这不是一个合格的邮箱地址哦,请再检查一遍!',
link: '你有个酷酷的网址吗?',
optional: '这个嘛,想填就填,不填也行!',
placeholder: '吐槽一下?',
sofa: '来,坐沙发上,发表你的评论吧!',
submit: '一键发送,让世界听到你的声音!',
like: '点个赞,让TA知道你的心意!',
cancelLike: '哎呀,不小心点错了,取消赞!',
reply: '回复TA,开启一场对话吧!',
cancelReply: '等等,我话还没说完,取消回复!',
comment: '来,说说你的看法,让评论区热闹起来!',
refresh: '刷新一下,看看有啥新动态!',
more: '哇塞,还有更多精彩内容等你来加载!',
preview: '先睹为快,预览一下你的大作吧!',
emoji: '来,加点表情,让你的评论更生动!',
uploadImage: '上传你的美照,让大家一起欣赏!',
seconds: '刚刚才发的,新鲜出炉!',
minutes: '几分钟前,还热乎着呢!',
hours: '几小时前,热度还在哦!',
days: '几天前,但依旧值得一看!',
now: '哇塞,刚刚发的,快抢沙发!',
uploading: '稍等片刻,你的图片正在飞奔而来!',
login: '登录一下,解锁更多功能!',
logout: '拜拜了您嘞,下次再见!',
admin: '博主大人在此,谁敢造次!',
sticky: '置顶一下,让更多人看到你的精彩内容!',
word: '字',
wordHint: '评论字数要在0到1字之间哦!\n现在你已经写了$2个字了,加油!',
anonymous: '神秘人出没,猜猜是谁?',
level0: '潜水员,深藏不露!',
level1: '冒泡小能手,偶尔露个头!',
level2: '吐槽大师,一针见血!',
level3: '活跃分子,无处不在!',
level4: '话痨达人,说个不停!',
level5: '传说级大神,膜拜一下!',
gif: '动态表情包,让你的评论更有趣!',
gifSearchPlaceholder: '快来搜索你喜欢的表情包,让评论更生动!',
profile: '看看我的个人资料,了解一下我吧!',
approved: '审核通过,可以展示啦!',
waiting: '正在等待审核,别急哦!',
spam: '垃圾内容,走开走开!',
unsticky: '换个位置看看!',
oldest: '看看最早的评论!',
latest: '看看最新的动态!',
hottest: '看看哪条评论最火!',
reactionTitle: '快来对这篇文章发表你的看法吧,让博主知道你的想法!😜'
};
const initWaline = () => {
const waline = Waline.init(Object.assign({
el: '#waline-wrap',
serverURL: 'https://bc.ctext.top/',
pageview: false,
dark: 'html[data-theme="dark"]',
path: window.location.pathname,
turnstileKey: '0x4AAAAAAAexA2vW2PBFT3wv',
comment: false,
copyright: false,
reaction: true,
locale
}, null))
}
const loadWaline = async () => {
if (typeof Waline === 'object') initWaline()
else {
await getCSS('https://cdn.cbd.int/@waline/client@3.1.3/dist/waline.css')
await getScript('https://cdn.cbd.int/@waline/client@3.1.3/dist/waline.js')
initWaline()
}
}
if ('Waline' === 'Waline' || !true) {
if (true) anzhiyu.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
window.loadOtherComment = loadWaline
}
})()</script><input type="hidden" name="page-type" id="page-type" value="post"></div><script>window.addEventListener('load', () => {
const changeContent = content => {
if (content === '') return content
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[图片]') // replace image link
content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url
content = content.replace(/<pre><code>.*?<\/pre>/gi, '[代码]') // replace code
content = content.replace(/<[^>]+>/g,"") // remove html tag
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const generateHtml = array => {
let result = ''
if (array.length) {
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (true) {
const name = 'data-lazy-src'
result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${anzhiyu.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
} else {
result += '没有评论'
}
let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom && ($dom.innerHTML= result)
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh($dom)
}
const getComment = async () => {
try {
const res = await fetch('https://bc.ctext.top/api/comment?type=recent&count=6', { method: 'GET' })
const result = await res.json()
const walineArray = result.data.map(e => {
return {
'content': changeContent(e.comment),
'avatar': e.avatar,
'nick': e.nick,
'url': e.url + '#' + e.objectId,
'date': e.time || e.insertedAt
}
})
saveToLocal.set('waline-newest-comments', JSON.stringify(walineArray), 10/(60*24))
generateHtml(walineArray)
} catch (err) {
console.error(err)
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.textContent= "无法获取评论,请确认相关配置是否正确"
}
}
const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('waline-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getComment()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})</script><script async data-pjax src="https://cdn.cbd.int/anzhiyu-theme-static@1.0.0/waterfall/waterfall.js"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.min.js"></script><script src="/js/anzhiyu/right_click_menu.js"></script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.1.9/icon/ali_iconfont_css.css"><script async src="https://at.alicdn.com/t/c/font_4489064_ow7l1rcvcw.js?spm=a313x.manage_type_myprojects.i1.12.61783a81xP1PqH&file=font_4489064_ow7l1rcvcw.js"></script><script async data-pjax src="/js/imgloaded.js?1"></script><script src="https://cdn.staticfile.org/jquery/3.6.3/jquery.min.js"></script><script defer="true" src="/js/welcome.js"></script><script defer="true" src="/js/hideRolling.js"></script><script defer="true" src="/js/countdown.js"></script><script defer src="https://cdn.jsdelivr.net/combine/npm/jquery@latest/dist/jquery.min.js,gh/weilining/jsdelivr/jquery/circlemagic/circlemagic.min.js,gh/weilining/jsdelivr@latest/jquery/circlemagic/butterflycirclemagic.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.cbd.int/butterfly-extsrc@1.1.3/dist/canvas-nest.min.js"></script><script id="click-heart" src="https://cdn.cbd.int/butterfly-extsrc@1.1.3/dist/click-heart.min.js" async="async" mobile="false"></script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.0.0/aplayer/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.cbd.int/anzhiyu-blog-static@1.0.1/js/APlayer.min.js"></script><script src="https://cdn.cbd.int/hexo-anzhiyu-music@1.0.1/assets/js/Meting2.min.js"></script><script src="https://cdn.cbd.int/pjax@0.2.8/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]
var pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
document.addEventListener('pjax:send', function () {
// removeEventListener scroll
anzhiyu.removeGlobalFnEvent('pjax')
anzhiyu.removeGlobalFnEvent('themeChange')
document.getElementById('rightside').classList.remove('rightside-show')
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
})
document.addEventListener('pjax:complete', function () {
window.refreshFn()
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof panguInit === 'function' && panguInit()
// google analytics
typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});
// baidu analytics
typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
// prismjs
typeof Prism === 'object' && Prism.highlightAll()
})
document.addEventListener('pjax:error', e => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><script charset="UTF-8" src="https://cdn.cbd.int/anzhiyu-theme-static@1.1.5/accesskey/accesskey.js"></script></div><div id="popup-window"><div class="popup-window-title">通知</div><div class="popup-window-divider"></div><div class="popup-window-content"><div class="popup-tip">你好呀</div><div class="popup-link"><i class="anzhiyufont anzhiyu-icon-arrow-circle-right"></i></div></div></div><!-- hexo injector body_end start --><script async src="//at.alicdn.com/t/font_2032782_8d5kxvn09md.js"></script><!-- hexo injector body_end end --></body></html>