[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"site-config":3,"primary-menu":6,"cat-docker":85,"catposts-docker":98,"post-detail-post-docker-install-zookeeper-72ccf30f":1004},{"config":4,"socialLinks":5},null,[],{"metadata":7,"spec":10,"menuItems":20},{"name":8,"creationTimestamp":9},"primary","2026-09-12T06:13:55.024154Z",{"displayName":11,"menuItems":12},"主菜单",[13,14,15,16,17,18,19],"88c3f10b-321c-4092-86a8-70db00251b74","menu-item-izrtmxer","c4c814d1-0c2c-456b-8c96-4864965fee94","menu-item-column","menu-item-tools","menu-item-zsxq","menu-item-ocrxlczu",[21,30,40,49,58,67,76],{"displayName":22,"metadata":23,"spec":25,"status":28,"children":29},"首页",{"name":13,"creationTimestamp":24},"2026-09-12T06:13:54.422830Z",{"displayName":22,"href":26,"priority":27,"menuName":8},"\u002F",0,{"displayName":22,"href":26},[],{"displayName":31,"metadata":32,"spec":34,"status":38,"children":39},"Java面试八股",{"name":14,"creationTimestamp":33},"2026-09-13T09:42:02.854891Z",{"displayName":31,"href":35,"target":36,"priority":37,"menuName":8},"\u002Fjava-interview","_self",1,{"displayName":31,"href":35},[],{"displayName":41,"metadata":42,"spec":44,"status":47,"children":48},"文章",{"name":15,"creationTimestamp":43},"2026-09-12T06:13:54.457307Z",{"displayName":41,"href":45,"priority":46,"menuName":8},"\u002Farchives",2,{"displayName":41,"href":45},[],{"displayName":50,"metadata":51,"spec":53,"status":56,"children":57},"项目实战",{"name":16,"creationTimestamp":52},"2026-09-14T00:35:08.138170Z",{"displayName":50,"href":54,"target":36,"priority":55,"menuName":8},"\u002Fcolumn",3,{"displayName":50,"href":54},[],{"displayName":59,"metadata":60,"spec":62,"status":65,"children":66},"在线工具",{"name":17,"creationTimestamp":61},"2026-09-14T00:35:08.171474Z",{"displayName":59,"href":63,"target":36,"priority":64,"menuName":8},"\u002Ftools",4,{"displayName":59,"href":63},[],{"displayName":68,"metadata":69,"spec":71,"status":74,"children":75},"知识星球",{"name":18,"creationTimestamp":70},"2026-09-14T00:35:08.199145Z",{"displayName":68,"href":72,"target":36,"priority":73,"menuName":8},"\u002Fzsxq",5,{"displayName":68,"href":72},[],{"displayName":77,"metadata":78,"spec":80,"status":83,"children":84},"特价云服务器",{"name":19,"creationTimestamp":79},"2026-09-25T15:30:59.201614Z",{"displayName":77,"href":81,"target":36,"priority":82,"menuName":8},"\u002Fserver",6,{"displayName":77,"href":81},[],{"metadata":86,"spec":89,"status":95,"postCount":97},{"name":87,"creationTimestamp":88},"test-docker-cat","2026-09-12T08:20:41.272236Z",{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},"Docker 教程","docker","\u002Fupload\u002Ftutorial-cover-docker.png","Docker 容器化实战教程：镜像与容器、Dockerfile、Docker Compose 及常用中间件部署。",false,{"permalink":96,"postCount":97,"visiblePostCount":97},"\u002Fcategories\u002Fdocker",43,[99,124,145,166,187,208,229,250,271,291,312,333,354,374,395,416,437,458,479,500,521,541,563,584,605,627,648,669,690,711,732,753,774,795,816,837,858,880,901,922,943,963,983],{"metadata":100,"spec":103,"status":114,"categories":119},{"name":101,"creationTimestamp":102},"post-windows-install-docker-7b76e7ed","2026-09-12T08:28:44.359805Z",{"title":104,"slug":105,"cover":106,"excerpt":107,"publishTime":109,"categories":110,"tags":111,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Windows 安装 Docker","windows-install-docker","\u002Fupload\u002Fcover-a1d86f6c6323.png",{"raw":108,"autoGenerate":94},"大家好，本小节中，我们将学习如何在 Windows 系统中安装 Docker 环境，全文图文讲解，超级详细...","2026-09-12T08:28:44.431185Z",[87],[],"PUBLIC",true,{"permalink":115,"excerpt":116,"lastModifyTime":117,"phase":118},"\u002Farchives\u002Fwindows-install-docker","本小节中，我们将学习如何在 Windows 系统中安装 Docker 环境，全文图文讲解，超级详细...","2026-09-14T00:21:04.050875Z","PUBLISHED",[120],{"metadata":121,"spec":122,"status":123,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":125,"spec":128,"status":137,"categories":140},{"name":126,"creationTimestamp":127},"post-why-use-docker-63e4ebba","2026-09-12T08:28:43.731698Z",{"title":129,"slug":130,"cover":131,"excerpt":132,"publishTime":134,"categories":135,"tags":136,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 和虚拟机的区别是什么？","why-use-docker","\u002Fupload\u002Fcover-4c84de248435.png",{"raw":133,"autoGenerate":94},"上小节中，我们了解到 Docker 是一种虚拟化技术，那么，相对于传统的虚拟机，两者之间有什么区别呢？为什么大厂流行用 Docker 呢？","2026-09-12T08:28:43.796231Z",[87],[],{"permalink":138,"excerpt":133,"lastModifyTime":139,"phase":118},"\u002Farchives\u002Fwhy-use-docker","2026-09-14T00:21:04.556515Z",[141],{"metadata":142,"spec":143,"status":144,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":146,"spec":149,"status":158,"categories":161},{"name":147,"creationTimestamp":148},"post-what-is-dockerfile-448ce59c","2026-09-12T08:28:43.099768Z",{"title":150,"slug":151,"cover":152,"excerpt":153,"publishTime":155,"categories":156,"tags":157,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"什么是 Dockerfile ?","what-is-dockerfile","\u002Fupload\u002Fcover-82e568c18a51.png",{"raw":154,"autoGenerate":94},"Dockerfile 是一个被用来构建 Docker 镜像的文本文件，该文件中包含了一行行的指令（Instruction），这些指令对应着修改、安装、构建、操作的命令，每一行指令构建一层（layer），层层累积，于是有了一个完整的镜像。","2026-09-12T08:28:43.153243Z",[87],[],{"permalink":159,"excerpt":154,"lastModifyTime":160,"phase":118},"\u002Farchives\u002Fwhat-is-dockerfile","2026-09-14T00:21:05.048687Z",[162],{"metadata":163,"spec":164,"status":165,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":167,"spec":170,"status":179,"categories":182},{"name":168,"creationTimestamp":169},"post-what-is-docker-f8a5e438","2026-09-12T08:28:42.477730Z",{"title":171,"slug":172,"cover":173,"excerpt":174,"publishTime":176,"categories":177,"tags":178,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 是干什么的？","what-is-docker","\u002Fupload\u002F166262085309991.jpg",{"raw":175,"autoGenerate":94},"Docker 是一个开源的应用容器引擎，它基于 GO 语言开发，可以让开发者在构建应用时，将应用与其依赖的环境一起打包到容器中, 然后很方便地发布到任意平台（Linux \u002F Windows）中,  以实现快速部署...","2026-09-12T08:28:42.542878Z",[87],[],{"permalink":180,"excerpt":175,"lastModifyTime":181,"phase":118},"\u002Farchives\u002Fwhat-is-docker","2026-09-14T00:21:05.462106Z",[183],{"metadata":184,"spec":185,"status":186,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":188,"spec":191,"status":200,"categories":203},{"name":189,"creationTimestamp":190},"post-what-is-docker-compose-d59b89d5","2026-09-12T08:28:41.836013Z",{"title":192,"slug":193,"cover":194,"excerpt":195,"publishTime":197,"categories":198,"tags":199,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker Compose 是干什么的？","what-is-docker-compose","\u002Fupload\u002Fcover-9a273941f45e.png",{"raw":196,"autoGenerate":94},"Docker Compose 是 Docker 官方的开源项目，能够实现对 Docker 容器集群的快速编排，以保证快速部署分布式应用 ...","2026-09-12T08:28:41.897727Z",[87],[],{"permalink":201,"excerpt":196,"lastModifyTime":202,"phase":118},"\u002Farchives\u002Fwhat-is-docker-compose","2026-09-14T00:21:05.975639Z",[204],{"metadata":205,"spec":206,"status":207,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":209,"spec":212,"status":221,"categories":224},{"name":210,"creationTimestamp":211},"post-what-diff-docker-k8s-23c07485","2026-09-12T08:28:41.236238Z",{"title":213,"slug":214,"cover":215,"excerpt":216,"publishTime":218,"categories":219,"tags":220,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"k8s 和 Docker 的区别是什么？","what-diff-docker-k8s","\u002Fupload\u002Fcover-7a64fd5e13c5.png",{"raw":217,"autoGenerate":94},"简单来说, ,k8s 和 Docker 并不是一个维度的东西，不具有可比性。它们之间是相互依存的关系，Docker 是容器引擎，而 k8s  是用来编排 Docker 等容器的协调器 ...","2026-09-12T08:28:41.301038Z",[87],[],{"permalink":222,"excerpt":217,"lastModifyTime":223,"phase":118},"\u002Farchives\u002Fwhat-diff-docker-k8s","2026-09-14T00:21:07.002754Z",[225],{"metadata":226,"spec":227,"status":228,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":230,"spec":233,"status":242,"categories":245},{"name":231,"creationTimestamp":232},"post-ubuntu-install-docker-3f241068","2026-09-12T08:28:40.591637Z",{"title":234,"slug":235,"cover":236,"excerpt":237,"publishTime":239,"categories":240,"tags":241,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Ubuntu 安装 Docker","ubuntu-install-docker","",{"raw":238,"autoGenerate":94},"要想在 Ubuntu 上安装 Docker，需要满足一些前置条件，才能安装 Docker。操作系统要求: Docker 支持以下版本的 Ubuntu  64 位操作系统， x86_64(或 amd64), armhf, arm64, 和 s390x CPU 架构均支持 Docker 安装...","2026-09-12T08:28:40.664959Z",[87],[],{"permalink":243,"excerpt":238,"lastModifyTime":244,"phase":118},"\u002Farchives\u002Fubuntu-install-docker","2026-09-12T08:28:40.595226Z",[246],{"metadata":247,"spec":248,"status":249,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":251,"spec":254,"status":263,"categories":266},{"name":252,"creationTimestamp":253},"post-macos-docker-install-1639dbf9","2026-09-12T08:28:39.867311Z",{"title":255,"slug":256,"cover":257,"excerpt":258,"publishTime":260,"categories":261,"tags":262,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"MacOS 安装 Docker","macos-docker-install","\u002Fupload\u002Fcover-6531a902ccd4.png",{"raw":259,"autoGenerate":94},"MacOS 苹果系统安装 Docker 两种方式，一种是使用 Homebrew 安装，另一种是手动下载安装包来安装，本文通过图文的方式，非常详细的讲解了如何在 MacOS 系统上完成 Docker 安装。","2026-09-12T08:28:39.928897Z",[87],[],{"permalink":264,"excerpt":259,"lastModifyTime":265,"phase":118},"\u002Farchives\u002Fmacos-docker-install","2026-09-14T00:21:07.689205Z",[267],{"metadata":268,"spec":269,"status":270,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":272,"spec":275,"status":283,"categories":286},{"name":273,"creationTimestamp":274},"post-dockerfile-commands-6162c113","2026-09-12T08:28:39.293708Z",{"title":276,"slug":277,"cover":236,"excerpt":278,"publishTime":280,"categories":281,"tags":282,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Dockerfile 常用指令汇总","dockerfile-commands",{"raw":279,"autoGenerate":94},"想要熟练使用 Dockerfile 制作构建镜像，就需要熟悉 Dockerfile 常用指令，前面小节中我们知道了 COPY 、ADD 指令，除此之外，Dockerfile 还额外提供了十多个指令。下面是 Dockerfile 常用指令汇总 ...","2026-09-12T08:28:39.353856Z",[87],[],{"permalink":284,"excerpt":279,"lastModifyTime":285,"phase":118},"\u002Farchives\u002Fdockerfile-commands","2026-09-12T08:28:39.297226Z",[287],{"metadata":288,"spec":289,"status":290,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":292,"spec":295,"status":304,"categories":307},{"name":293,"creationTimestamp":294},"post-dockerfile-build-image-59898e1c","2026-09-12T08:28:38.683864Z",{"title":296,"slug":297,"cover":298,"excerpt":299,"publishTime":301,"categories":302,"tags":303,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Dockerfile 制作构建镜像","dockerfile-build-image","\u002Fupload\u002Fcover-5d0745d6b951.png",{"raw":300,"autoGenerate":94},"本小节中，我们将上手通过 Dockerfile 制作第一个镜像，此镜像也非常简单，即定制一个 Nginx 镜像，唯一不同的是，我们需要将 Nginx 默认的首页欢迎语更改为 Hello, Nginx by Docker ...","2026-09-12T08:28:38.762107Z",[87],[],{"permalink":305,"excerpt":300,"lastModifyTime":306,"phase":118},"\u002Farchives\u002Fdockerfile-build-image","2026-09-14T00:21:08.257217Z",[308],{"metadata":309,"spec":310,"status":311,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":313,"spec":316,"status":325,"categories":328},{"name":314,"creationTimestamp":315},"post-docker-volume-2ab5edb3","2026-09-12T08:28:37.847806Z",{"title":317,"slug":318,"cover":319,"excerpt":320,"publishTime":322,"categories":323,"tags":324,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 数据卷","docker-volume","\u002Fupload\u002Fcover-4bbe3061884e.png",{"raw":321,"autoGenerate":94},"简单来说，数据卷是一个可供一个或多个容器使用的特殊目录，用于持久化数据以及共享容器间的数据，它以正常的文件或目录的形式存在于宿主机上。另外，其生命周期独立于容器的生命周期，即当你删除容器时，数据卷并不会被删除 ...","2026-09-12T08:28:38.029002Z",[87],[],{"permalink":326,"excerpt":321,"lastModifyTime":327,"phase":118},"\u002Farchives\u002Fdocker-volume","2026-09-14T00:21:08.639580Z",[329],{"metadata":330,"spec":331,"status":332,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":334,"spec":337,"status":346,"categories":349},{"name":335,"creationTimestamp":336},"post-docker-volume-container-9d665afc","2026-09-12T08:28:37.210457Z",{"title":338,"slug":339,"cover":340,"excerpt":341,"publishTime":343,"categories":344,"tags":345,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 数据卷容器","docker-volume-container","\u002Fupload\u002F165804090120953.jpg",{"raw":342,"autoGenerate":94},"如果你有一些需要持续更新的数据需要在容器之间共享，最佳实践是创建数据卷容器。数据卷容器，其实就是一个正常的 Docker 容器，专门用于提供数据卷供其他容器挂载的 ...","2026-09-12T08:28:37.263345Z",[87],[],{"permalink":347,"excerpt":342,"lastModifyTime":348,"phase":118},"\u002Farchives\u002Fdocker-volume-container","2026-09-13T05:18:47.535534Z",[350],{"metadata":351,"spec":352,"status":353,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":355,"spec":358,"status":366,"categories":369},{"name":356,"creationTimestamp":357},"post-docker-volume-backup-8d4028da","2026-09-12T08:28:36.602929Z",{"title":359,"slug":360,"cover":236,"excerpt":361,"publishTime":363,"categories":364,"tags":365,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 使用数据卷容器备份、恢复、迁移数据卷","docker-volume-backup",{"raw":362,"autoGenerate":94},"本小节中，我们将学习如何对数据卷容器中的数据进行进行备份、恢复和迁移。首先使用 --volumes-from 命令创建一个加载 dbdata 的容器卷容器 ...","2026-09-12T08:28:36.662322Z",[87],[],{"permalink":367,"excerpt":362,"lastModifyTime":368,"phase":118},"\u002Farchives\u002Fdocker-volume-backup","2026-09-12T08:28:36.606521Z",[370],{"metadata":371,"spec":372,"status":373,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":375,"spec":378,"status":387,"categories":390},{"name":376,"creationTimestamp":377},"post-docker-upload-image-b7b32c97","2026-09-12T08:28:35.848750Z",{"title":379,"slug":380,"cover":381,"excerpt":382,"publishTime":384,"categories":385,"tags":386,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 上传镜像","docker-upload-image","\u002Fupload\u002Fcover-dfe11ebe8783.png",{"raw":383,"autoGenerate":94},"本文中，我们将学习如何将镜像上传至 Docker Hub 上。想要上传镜像到 Docker Hub 上，首先，我们需要注册 Docker Hub 账号。打开 Docker Hub 网址 https:\u002F\u002Fhub.docker.com，开始注册 ...","2026-09-12T08:28:35.907099Z",[87],[],{"permalink":388,"excerpt":383,"lastModifyTime":389,"phase":118},"\u002Farchives\u002Fdocker-upload-image","2026-09-14T00:21:09.433485Z",[391],{"metadata":392,"spec":393,"status":394,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":396,"spec":399,"status":408,"categories":411},{"name":397,"creationTimestamp":398},"post-docker-total-cmd-c814048a","2026-09-12T08:28:35.278844Z",{"title":400,"slug":401,"cover":402,"excerpt":403,"publishTime":405,"categories":406,"tags":407,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 常用命令大全","docker-total-cmd","\u002Fupload\u002F166255773325089.jpg",{"raw":404,"autoGenerate":94},"本文汇总了 Docker 常用的一些命令，分门别类都总结好了，超级全面...","2026-09-12T08:28:35.346290Z",[87],[],{"permalink":409,"excerpt":404,"lastModifyTime":410,"phase":118},"\u002Farchives\u002Fdocker-total-cmd","2026-09-13T05:18:57.588086Z",[412],{"metadata":413,"spec":414,"status":415,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":417,"spec":420,"status":429,"categories":432},{"name":418,"creationTimestamp":419},"post-docker-stop-container-77342052","2026-09-12T08:28:34.458193Z",{"title":421,"slug":422,"cover":423,"excerpt":424,"publishTime":426,"categories":427,"tags":428,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 停止&amp;关闭容器","docker-stop-container","\u002Fupload\u002F165683843779847.jpg",{"raw":425,"autoGenerate":94},"Docker 中通过 docker container stop 命令停止关闭一个正在运行的容器，举个例子🌰，比如想要停止下图中的 Ubuntu 容器，通过容器 ID 或者容器名称都可以停止容器 ...","2026-09-12T08:28:34.517887Z",[87],[],{"permalink":430,"excerpt":425,"lastModifyTime":431,"phase":118},"\u002Farchives\u002Fdocker-stop-container","2026-09-13T05:18:58.637618Z",[433],{"metadata":434,"spec":435,"status":436,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":438,"spec":441,"status":450,"categories":453},{"name":439,"creationTimestamp":440},"post-docker-search-image-57657128","2026-09-12T08:28:33.812287Z",{"title":442,"slug":443,"cover":444,"excerpt":445,"publishTime":447,"categories":448,"tags":449,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 搜索镜像","docker-search-image","\u002Fupload\u002F165700112104243.jpg",{"raw":446,"autoGenerate":94},"在 Docker 中，通过 docker search [option] keyword 命令搜索镜像，比如，你想搜索仓库中 mysql 相关的镜像，可以输入如下命令 ...","2026-09-12T08:28:33.871570Z",[87],[],{"permalink":451,"excerpt":446,"lastModifyTime":452,"phase":118},"\u002Farchives\u002Fdocker-search-image","2026-09-13T05:19:00.305759Z",[454],{"metadata":455,"spec":456,"status":457,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":459,"spec":462,"status":471,"categories":474},{"name":460,"creationTimestamp":461},"post-docker-save-load-image-e3603a96","2026-09-12T08:28:33.199217Z",{"title":463,"slug":464,"cover":465,"excerpt":466,"publishTime":468,"categories":469,"tags":470,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 导出&amp;导入镜像","docker-save-load-image","\u002Fupload\u002F165700399037320.jpg",{"raw":467,"autoGenerate":94},"日常编码中，如果需要将自己本地的镜像分享给别人，可以将镜像导出成 tar 包，别人直接导入这个 tar 包，即可将镜像引入到本地镜像库。小伙伴可以通过 docker save 命令可以导出 Docker 镜像 ...","2026-09-12T08:28:33.254322Z",[87],[],{"permalink":472,"excerpt":467,"lastModifyTime":473,"phase":118},"\u002Farchives\u002Fdocker-save-load-image","2026-09-13T05:19:00.962108Z",[475],{"metadata":476,"spec":477,"status":478,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":480,"spec":483,"status":492,"categories":495},{"name":481,"creationTimestamp":482},"post-docker-run-container-67ac48aa","2026-09-12T08:28:32.567783Z",{"title":484,"slug":485,"cover":486,"excerpt":487,"publishTime":489,"categories":490,"tags":491,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 启动容器","docker-run-container","\u002Fupload\u002F165675444666134.jpg",{"raw":488,"autoGenerate":94},"启动容器有两种方式，第一种是基于镜像新建一个容器并启动，第二种是将在终止状态 exited 的容器重新启动，本文以图文的方式告诉大家如何启动 Docker 容器 ...","2026-09-12T08:28:32.633365Z",[87],[],{"permalink":493,"excerpt":488,"lastModifyTime":494,"phase":118},"\u002Farchives\u002Fdocker-run-container","2026-09-13T05:19:02.556640Z",[496],{"metadata":497,"spec":498,"status":499,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":501,"spec":504,"status":513,"categories":516},{"name":502,"creationTimestamp":503},"post-docker-restart-container-f6aa701c","2026-09-12T08:28:31.942254Z",{"title":505,"slug":506,"cover":507,"excerpt":508,"publishTime":510,"categories":511,"tags":512,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 重启容器","docker-restart-container","\u002Fupload\u002F165693588723614.jpg",{"raw":509,"autoGenerate":94},"执行 docker restart [container ID or NAMES] 命令重启 Docker 容器，举个例子🌰，比如想要重启下面的 Redis 容器 ...","2026-09-12T08:28:32.010484Z",[87],[],{"permalink":514,"excerpt":509,"lastModifyTime":515,"phase":118},"\u002Farchives\u002Fdocker-restart-container","2026-09-13T05:19:03.126874Z",[517],{"metadata":518,"spec":519,"status":520,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":522,"spec":525,"status":533,"categories":536},{"name":523,"creationTimestamp":524},"post-docker-repository-9d5fb9d2","2026-09-12T08:28:31.303127Z",{"title":526,"slug":527,"cover":236,"excerpt":528,"publishTime":530,"categories":531,"tags":532,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 仓库","docker-repository",{"raw":529,"autoGenerate":94},"一个 Docker Registry 中可以包含多个仓库（Repository）；每个仓库可以包含多个标签（Tag）；每个标签对应一个镜像 ...","2026-09-12T08:28:31.370426Z",[87],[],{"permalink":534,"excerpt":529,"lastModifyTime":535,"phase":118},"\u002Farchives\u002Fdocker-repository","2026-09-12T08:28:31.308023Z",[537],{"metadata":538,"spec":539,"status":540,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":542,"spec":545,"status":554,"categories":558},{"name":543,"creationTimestamp":544},"post-docker-remove-image-22a14910","2026-09-12T08:28:30.044587Z",{"title":546,"slug":547,"cover":548,"excerpt":549,"publishTime":551,"categories":552,"tags":553,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 删除镜像","docker-remove-image","\u002Fupload\u002F165641372835974.jpg",{"raw":550,"autoGenerate":94},"大家好，本小节中，将学习 Docker 如何删除镜像。有两种方式，分别是通过标签删除镜像，以及通过 ID 删除镜像。","2026-09-12T08:28:30.170036Z",[87],[],{"permalink":555,"excerpt":556,"lastModifyTime":557,"phase":118},"\u002Farchives\u002Fdocker-remove-image","本小节中，将学习 Docker 如何删除镜像。有两种方式，分别是通过标签删除镜像，以及通过 ID 删除镜像。","2026-09-13T05:19:04.427106Z",[559],{"metadata":560,"spec":561,"status":562,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":564,"spec":567,"status":576,"categories":579},{"name":565,"creationTimestamp":566},"post-docker-ps-container-cc726a97","2026-09-12T08:28:29.271365Z",{"title":568,"slug":569,"cover":570,"excerpt":571,"publishTime":573,"categories":574,"tags":575,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 查看容器","docker-ps-container","\u002Fupload\u002F165692898193876.jpg",{"raw":572,"autoGenerate":94},"在 Docker 中，我们可以通过 docker ps 命令查看正在运行中的容器，docker ps -a 命令可以查看所有容器，包括运行中的、已经停止运行的容器...","2026-09-12T08:28:29.336224Z",[87],[],{"permalink":577,"excerpt":572,"lastModifyTime":578,"phase":118},"\u002Farchives\u002Fdocker-ps-container","2026-09-13T05:19:05.550572Z",[580],{"metadata":581,"spec":582,"status":583,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":585,"spec":588,"status":597,"categories":600},{"name":586,"creationTimestamp":587},"post-docker-nginx-install-ssl-a377919f","2026-09-12T08:28:28.665687Z",{"title":589,"slug":590,"cover":591,"excerpt":592,"publishTime":594,"categories":595,"tags":596,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker Nginx 配置安装 SSL 证书（支持 Https 访问）","docker-nginx-install-ssl","\u002Fupload\u002Fcover-4ca56e528d21.png",{"raw":593,"autoGenerate":94},"上小节《Docker 安装 Nginx》中，我们已经学会了通过 Docker 快速安装 Nginx ，以及配置反向代理，本小节中，我们将学习如何为 Nginx 配置安装 SSL 证书，使网站支持通过 Https 协议访问 ...","2026-09-12T08:28:28.738926Z",[87],[],{"permalink":598,"excerpt":593,"lastModifyTime":599,"phase":118},"\u002Farchives\u002Fdocker-nginx-install-ssl","2026-09-14T00:21:10.398179Z",[601],{"metadata":602,"spec":603,"status":604,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":606,"spec":609,"status":618,"categories":622},{"name":607,"creationTimestamp":608},"post-docker-look-image-6e9a9628","2026-09-12T08:28:28.024749Z",{"title":610,"slug":611,"cover":612,"excerpt":613,"publishTime":615,"categories":616,"tags":617,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 查看镜像信息","docker-look-image","\u002Fupload\u002F165648660235112.jpg",{"raw":614,"autoGenerate":94},"大家好，本小节中，我们将学习 Docker 如何查看镜像信息。通过命令 docker images 或者 docker image ls 即可列出本地已下载的镜像 ...","2026-09-12T08:28:28.085240Z",[87],[],{"permalink":619,"excerpt":620,"lastModifyTime":621,"phase":118},"\u002Farchives\u002Fdocker-look-image","本小节中，我们将学习 Docker 如何查看镜像信息。通过命令 docker images 或者 docker image ls 即可列出本地已下载的镜像 ...","2026-09-13T05:19:16.479315Z",[623],{"metadata":624,"spec":625,"status":626,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":628,"spec":631,"status":640,"categories":643},{"name":629,"creationTimestamp":630},"post-docker-install-zookeeper-72ccf30f","2026-09-12T08:28:27.267923Z",{"title":632,"slug":633,"cover":634,"excerpt":635,"publishTime":637,"categories":638,"tags":639,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Zookeeper（图文教程）","docker-install-zookeeper","\u002Fupload\u002F172293048784392.jpg",{"raw":636,"autoGenerate":94},"我们已经测试了美团 Leaf-segment 号段模式（依赖数据库）来获取分布式 ID ,  除了该模式外，还有 Leaf-snowflake  （基于雪花算法）模式，它依赖于 Zookeeper , 所以，本小节的内容是，在本地通过 Docker 将单机版的 Zookeeper 环境搭建好。","2026-09-12T08:28:27.343802Z",[87],[],{"permalink":641,"excerpt":636,"lastModifyTime":642,"phase":118},"\u002Farchives\u002Fdocker-install-zookeeper","2026-09-13T05:19:21.645282Z",[644],{"metadata":645,"spec":646,"status":647,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":649,"spec":652,"status":661,"categories":664},{"name":650,"creationTimestamp":651},"post-docker-install-redis-5af17add","2026-09-12T08:28:26.614853Z",{"title":653,"slug":654,"cover":655,"excerpt":656,"publishTime":658,"categories":659,"tags":660,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Redis（图文教程）","docker-install-redis","\u002Fupload\u002F165624364123749.png",{"raw":657,"autoGenerate":94},"在星球第二个项目后续的业务功能开发中，会频繁使用到分布式缓存 Redis，那么，本小节中，我就将演示如何通过 Docker 快速的将本地的 Redis 环境搭建好...","2026-09-12T08:28:26.683365Z",[87],[],{"permalink":662,"excerpt":657,"lastModifyTime":663,"phase":118},"\u002Farchives\u002Fdocker-install-redis","2026-09-13T05:19:35.352647Z",[665],{"metadata":666,"spec":667,"status":668,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":670,"spec":673,"status":682,"categories":685},{"name":671,"creationTimestamp":672},"post-docker-install-nginx-f7369a19","2026-09-12T08:28:25.931765Z",{"title":674,"slug":675,"cover":676,"excerpt":677,"publishTime":679,"categories":680,"tags":681,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Nginx","docker-install-nginx","\u002Fupload\u002F165736441796898.jpg",{"raw":678,"autoGenerate":94},"本小节中，我们将学习如何通过 Docker 快速安装 Ngnix, 并反向代理到后台的 Web 服务。 执行 docker pull nginx:1.19.4 下载 Nginx 镜像，命令执行成功后，通过 docker images 命令检查一下镜像是否下载成功...","2026-09-12T08:28:25.994216Z",[87],[],{"permalink":683,"excerpt":678,"lastModifyTime":684,"phase":118},"\u002Farchives\u002Fdocker-install-nginx","2026-09-14T00:21:10.892893Z",[686],{"metadata":687,"spec":688,"status":689,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":691,"spec":694,"status":703,"categories":706},{"name":692,"creationTimestamp":693},"post-docker-install-mysql-4f03f35f","2026-09-12T08:28:25.312248Z",{"title":695,"slug":696,"cover":697,"excerpt":698,"publishTime":700,"categories":701,"tags":702,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 MySQL（图文教程）","docker-install-mysql","\u002Fupload\u002F165702232024982.jpg",{"raw":699,"autoGenerate":94},"本小节中，我们将学习如何通过 Docker 快速安装 Mysql 环境。这里以安装 Mysql 5.7 版本为例，执行 docker pull mysql:5.7 命令，下载完成后，通过 docker images 检查一下镜像是否下载成功...","2026-09-12T08:28:25.380377Z",[87],[],{"permalink":704,"excerpt":699,"lastModifyTime":705,"phase":118},"\u002Farchives\u002Fdocker-install-mysql","2026-09-14T00:21:11.609663Z",[707],{"metadata":708,"spec":709,"status":710,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":712,"spec":715,"status":724,"categories":727},{"name":713,"creationTimestamp":714},"post-docker-install-minio-b6dec88d","2026-09-12T08:28:24.603453Z",{"title":716,"slug":717,"cover":718,"excerpt":719,"publishTime":721,"categories":722,"tags":723,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Minio 分布式存储（图文教程）","docker-install-minio","\u002Fupload\u002F169663913789430.jpg",{"raw":720,"autoGenerate":94},"在我们的《前后端分离博客项目中》，涉及到上传博客 LOGO 图片、作者头像，以及后续发布文章也需要支持图片上传。所以，我们首先需要搭建一个图床服务，这里我选型的是 Minio 对象存储，它不光可以存储图片，还能存储文件、视频等，非常强大...","2026-09-12T08:28:24.669227Z",[87],[],{"permalink":725,"excerpt":720,"lastModifyTime":726,"phase":118},"\u002Farchives\u002Fdocker-install-minio","2026-09-14T00:21:12.617965Z",[728],{"metadata":729,"spec":730,"status":731,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":733,"spec":736,"status":745,"categories":748},{"name":734,"creationTimestamp":735},"post-docker-install-jenkins-cac21be2","2026-09-12T08:28:23.983351Z",{"title":737,"slug":738,"cover":739,"excerpt":740,"publishTime":742,"categories":743,"tags":744,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Jenkins（图文教程）","docker-install-jenkins","\u002Fupload\u002Fcover-b97f087a779d.png",{"raw":741,"autoGenerate":94},"Jenkins 是一个开源的持续集成（Continuous Integration）工具，它的主要作用是帮助开发团队自动化构建、测试和部署软件项目。通俗来说，Jenkins 可以在每次代码变更时，帮助我们自动进行一系列的操作，例如编译代码、运行测试、生成文档，甚至是将应用程序部署到服务器上。","2026-09-12T08:28:24.043455Z",[87],[],{"permalink":746,"excerpt":741,"lastModifyTime":747,"phase":118},"\u002Farchives\u002Fdocker-install-jenkins","2026-09-14T00:21:13.189071Z",[749],{"metadata":750,"spec":751,"status":752,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":754,"spec":757,"status":766,"categories":769},{"name":755,"creationTimestamp":756},"post-docker-install-compose-d427ef40","2026-09-12T08:28:23.146866Z",{"title":758,"slug":759,"cover":760,"excerpt":761,"publishTime":763,"categories":764,"tags":765,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker Compose 安装与卸载","docker-install-compose","\u002Fupload\u002F166366076551050.png",{"raw":762,"autoGenerate":94},"Docker Compose 支持 Linux、MacOS、Windows 10 以及更高版本等主流操作系统的安装，本文通过图文详细说明了不同系统中，Docker Compose 要如何镜像安装与卸载 ...","2026-09-12T08:28:23.213491Z",[87],[],{"permalink":767,"excerpt":762,"lastModifyTime":768,"phase":118},"\u002Farchives\u002Fdocker-install-compose","2026-09-13T05:20:22.953112Z",[770],{"metadata":771,"spec":772,"status":773,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":775,"spec":778,"status":787,"categories":790},{"name":776,"creationTimestamp":777},"post-docker-install-cassandra-03d02f70","2026-09-12T08:28:22.473185Z",{"title":779,"slug":780,"cover":781,"excerpt":782,"publishTime":784,"categories":785,"tags":786,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 安装 Cassandra 数据库（图文教程）","docker-install-cassandra","\u002Fupload\u002F172179052498364.jpg",{"raw":783,"autoGenerate":94},"本小节中，我们将通过 Docker 把本地的 Cassandra 测试环境搭建起来。Apache Cassandra 是一个开源的分布式 NoSQL（Not Only SQL）数据库管理系统，专为处理大规模数据量和高写入频率的工作负载而设计。","2026-09-12T08:28:22.546599Z",[87],[],{"permalink":788,"excerpt":783,"lastModifyTime":789,"phase":118},"\u002Farchives\u002Fdocker-install-cassandra","2026-09-13T05:20:25.158312Z",[791],{"metadata":792,"spec":793,"status":794,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":796,"spec":799,"status":808,"categories":811},{"name":797,"creationTimestamp":798},"post-docker-image-e76362b6","2026-09-12T08:28:21.839619Z",{"title":800,"slug":801,"cover":802,"excerpt":803,"publishTime":805,"categories":806,"tags":807,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 镜像","docker-image","\u002Fupload\u002Fcover-c40a46c7dc01.png",{"raw":804,"autoGenerate":94},"镜像是 Docker 的三个基本概念之一，它是 Docker 运行容器的前提，仓库是存放镜像的场所。Docker 镜像是一个特殊的文件系统，除了提供容器运行时所需的程序、库、资源、配置等文件外...","2026-09-12T08:28:21.903334Z",[87],[],{"permalink":809,"excerpt":804,"lastModifyTime":810,"phase":118},"\u002Farchives\u002Fdocker-image","2026-09-14T00:21:13.584509Z",[812],{"metadata":813,"spec":814,"status":815,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":817,"spec":820,"status":829,"categories":832},{"name":818,"creationTimestamp":819},"post-docker-export-import-container-541bad36","2026-09-12T08:28:21.240842Z",{"title":821,"slug":822,"cover":823,"excerpt":824,"publishTime":826,"categories":827,"tags":828,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 导出&amp;导入容器","docker-export-import-container","\u002Fupload\u002F165698500345714.jpg",{"raw":825,"autoGenerate":94},"使用 docker export 命令可以导出容器，比如想导出下面的 Redis 容器，执行  docker export 9e8d11aeef0c &gt; redis.tar 命令即可，导出的 tar 包快照存于当前目录下...","2026-09-12T08:28:21.304957Z",[87],[],{"permalink":830,"excerpt":825,"lastModifyTime":831,"phase":118},"\u002Farchives\u002Fdocker-export-import-container","2026-09-13T05:20:25.998391Z",[833],{"metadata":834,"spec":835,"status":836,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":838,"spec":841,"status":850,"categories":853},{"name":839,"creationTimestamp":840},"post-docker-exec-container-4e90d582","2026-09-12T08:28:20.597994Z",{"title":842,"slug":843,"cover":844,"excerpt":845,"publishTime":847,"categories":848,"tags":849,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 进入容器命令","docker-exec-container","\u002Fupload\u002F165685069315125.jpg",{"raw":846,"autoGenerate":94},"要想进入到已运行的 Docker 容器，主要有如下两种方式，第一种使用 docker exec命令，第二种使用 docker attach 命令...","2026-09-12T08:28:20.663925Z",[87],[],{"permalink":851,"excerpt":846,"lastModifyTime":852,"phase":118},"\u002Farchives\u002Fdocker-exec-container","2026-09-13T05:20:26.724480Z",[854],{"metadata":855,"spec":856,"status":857,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":859,"spec":862,"status":871,"categories":875},{"name":860,"creationTimestamp":861},"post-docker-download-image-bae8d2fe","2026-09-12T08:28:19.928197Z",{"title":863,"slug":864,"cover":865,"excerpt":866,"publishTime":868,"categories":869,"tags":870,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 拉取&amp;下载镜像","docker-download-image","\u002Fupload\u002F165648522762749.jpg",{"raw":867,"autoGenerate":94},"大家好，本文中，我们将需要学习 Docker 如何拉取&amp;下载镜像？想要在本地运行 Docker 容器，需要先下载 Docker 镜像。默认情况下，Docker 会尝试从 Docker Hub 镜像仓库下载。另外，用户也可以自定义配置镜像仓库地址 ...","2026-09-12T08:28:19.996485Z",[87],[],{"permalink":872,"excerpt":873,"lastModifyTime":874,"phase":118},"\u002Farchives\u002Fdocker-download-image","本文中，我们将需要学习 Docker 如何拉取&amp;下载镜像？想要在本地运行 Docker 容器，需要先下载 Docker 镜像。默认情况下，Docker 会尝试从 Docker Hub 镜像仓库下载。另外，用户也可以自定义配置镜像仓库地址 ...","2026-09-13T05:20:27.610905Z",[876],{"metadata":877,"spec":878,"status":879,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":881,"spec":884,"status":893,"categories":896},{"name":882,"creationTimestamp":883},"post-docker-delete-container-561986e7","2026-09-12T08:28:19.306727Z",{"title":885,"slug":886,"cover":887,"excerpt":888,"publishTime":890,"categories":891,"tags":892,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 删除容器","docker-delete-container","\u002Fupload\u002F165685534557469.jpg",{"raw":889,"autoGenerate":94},"本小节中将学习如何删除 Docker 容器。执行 docker container rm 命令可以删除一个已经停止运行的容器。举个例子，比如想要删除下面的 Redis 容器...","2026-09-12T08:28:19.369523Z",[87],[],{"permalink":894,"excerpt":889,"lastModifyTime":895,"phase":118},"\u002Farchives\u002Fdocker-delete-container","2026-09-13T05:20:28.217987Z",[897],{"metadata":898,"spec":899,"status":900,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":902,"spec":905,"status":914,"categories":917},{"name":903,"creationTimestamp":904},"post-docker-container-bccc3314","2026-09-12T08:28:18.682458Z",{"title":906,"slug":907,"cover":908,"excerpt":909,"publishTime":911,"categories":912,"tags":913,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 容器","docker-container","\u002Fupload\u002Fcover-900796218579.png",{"raw":910,"autoGenerate":94},"通过 Docker 镜像运行的实例称之为容器，两者的关系就像是面向对象程序设计中的类和实例一样，镜像是静态的定义，容器是镜像运行时的实体。容器可以被创建、启动、停止、删除、暂停等 ...","2026-09-12T08:28:18.747600Z",[87],[],{"permalink":915,"excerpt":910,"lastModifyTime":916,"phase":118},"\u002Farchives\u002Fdocker-container","2026-09-14T00:21:13.932628Z",[918],{"metadata":919,"spec":920,"status":921,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":923,"spec":926,"status":935,"categories":938},{"name":924,"creationTimestamp":925},"post-docker-compose-example-5841178a","2026-09-12T08:28:18.028525Z",{"title":927,"slug":928,"cover":929,"excerpt":930,"publishTime":932,"categories":933,"tags":934,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker Compose 实战 web 服务","docker-compose-example","\u002Fupload\u002F166467690411164.png",{"raw":931,"autoGenerate":94},"本小节中，我们将通过 Docker Compose 搭建一个简单的网站。这个简单的网站需实现功能：每当用户访问时，页面显示总访问次数 ...","2026-09-12T08:28:18.096894Z",[87],[],{"permalink":936,"excerpt":931,"lastModifyTime":937,"phase":118},"\u002Farchives\u002Fdocker-compose-example","2026-09-13T05:20:32.006565Z",[939],{"metadata":940,"spec":941,"status":942,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":944,"spec":947,"status":955,"categories":958},{"name":945,"creationTimestamp":946},"post-docker-compose-commands-4193309c","2026-09-12T08:28:17.286875Z",{"title":948,"slug":949,"cover":236,"excerpt":950,"publishTime":952,"categories":953,"tags":954,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker Compose 命令大全","docker-compose-commands",{"raw":951,"autoGenerate":94},"本小节中，我们将学习 docker-compose 命令的使用，以及相关命令说明 ...","2026-09-12T08:28:17.374056Z",[87],[],{"permalink":956,"excerpt":951,"lastModifyTime":957,"phase":118},"\u002Farchives\u002Fdocker-compose-commands","2026-09-12T08:28:17.290603Z",[959],{"metadata":960,"spec":961,"status":962,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":964,"spec":967,"status":975,"categories":978},{"name":965,"creationTimestamp":966},"post-centos-install-docker-6341005b","2026-09-12T08:28:16.420289Z",{"title":968,"slug":969,"cover":236,"excerpt":970,"publishTime":972,"categories":973,"tags":974,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"CentOS 安装 Docker","centos-install-docker",{"raw":971,"autoGenerate":94},"Docker 支持以下 64 位的 CentOS 版本, 且内核版本不低于 3.10, 安装之前，请先卸载旧版本的 Docker ...","2026-09-12T08:28:16.506229Z",[87],[],{"permalink":976,"excerpt":971,"lastModifyTime":977,"phase":118},"\u002Farchives\u002Fcentos-install-docker","2026-09-12T08:28:16.424268Z",[979],{"metadata":980,"spec":981,"status":982,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":984,"spec":987,"status":996,"categories":999},{"name":985,"creationTimestamp":986},"post-aliyun-docker-registry-ffd7badf","2026-09-12T08:28:15.567618Z",{"title":988,"slug":989,"cover":990,"excerpt":991,"publishTime":993,"categories":994,"tags":995,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},"Docker 镜像加速器（配置阿里云）","aliyun-docker-registry","\u002Fupload\u002Fcover-0cca1a8bc3e5.png",{"raw":992,"autoGenerate":94},"Docker 默认情况下是从官方 Docker Hub 下载镜像，但是由于 Docker Hub 服务器在国外的缘故，国内用户在下载镜像的时候，会非常慢。想要解决这个问题，我们可以配置国内的镜像加速器，如阿里云加速器、DaoCloud、网易加速器、百度云加速器等等。接下来，我将演示如何配置阿里云镜像加速器。","2026-09-12T08:28:15.641590Z",[87],[],{"permalink":997,"excerpt":992,"lastModifyTime":998,"phase":118},"\u002Farchives\u002Faliyun-docker-registry","2026-09-14T00:21:14.569395Z",[1000],{"metadata":1001,"spec":1002,"status":1003,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"metadata":1005,"spec":1006,"status":1010,"categories":1011,"content":1016},{"name":629,"creationTimestamp":630},{"title":632,"slug":633,"cover":634,"excerpt":1007,"publishTime":637,"categories":1008,"tags":1009,"priority":27,"pinned":94,"deleted":94,"visible":112,"allowComment":113},{"raw":636,"autoGenerate":94},[87],[],{"permalink":641,"excerpt":636,"lastModifyTime":642,"phase":118},[1012],{"metadata":1013,"spec":1014,"status":1015,"postCount":97},{"name":87,"creationTimestamp":88},{"displayName":90,"slug":91,"cover":92,"description":93,"priority":27,"hideFromList":94,"preventParentPostCascadeQuery":94},{"permalink":96,"postCount":97,"visiblePostCount":97},{"content":1017,"raw":1017},"\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293048784392.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Cp>上小节\u003Cspan>\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" style=\"color: #aaa; margin-left: 3px;\" aria-hidden=\"true\" focusable=\"false\" x=\"0px\" y=\"0px\" viewBox=\"0 0 100 100\" width=\"15\" height=\"15\" class=\"icon outbound\">\u003Cpath fill=\"currentColor\" d=\"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z\">\u003C\u002Fpath> \u003Cpolygon fill=\"currentColor\" points=\"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9\">\u003C\u002Fpolygon>\u003C\u002Fsvg> \u003Cspan class=\"sr-only\">\u003C\u002Fspan>\u003C\u002Fspan>中，我们已经测试了美团 \u003Ccode>Leaf-segment\u003C\u002Fcode> 号段模式（依赖数据库）来获取分布式 ID ,  除了该模式外，还有 \u003Ccode>Leaf-snowflake\u003C\u002Fcode>  （基于雪花算法）模式，它依赖于 Zookeeper , 所以，本小节的内容是，在本地通过 Docker 将单机版的 Zookeeper 环境搭建好。\u003C\u002Fp>\n\u003Ch2>Zookeeper 介绍\u003C\u002Fh2>\n\u003Cp>Apache ZooKeeper 是一个开源的分布式协调服务，用于大型分布式系统的开发和管理。它提供了一种简单而统一的方法来解决分布式应用中常见的协调问题，如命名服务、配置管理、集群管理、组服务、分布式锁、队列管理等。ZooKeeper 通过提供一种类似文件系统的结构来存储数据，并允许客户端通过简单的 API 进行读写操作，从而简化了分布式系统的复杂度。\u003C\u002Fp>\n\u003Cp>Zookeeper 的核心特性如下：\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>一致性\u003C\u002Fstrong>：对于任何更新，所有客户端都将看到相同的数据视图。这是通过 ZooKeeper 的原子性保证的，意味着所有更新要么完全成功，要么完全失败。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>可靠性\u003C\u002Fstrong>：一旦数据被提交，它将被持久化存储，即使在某些服务器出现故障的情况下，数据也不会丢失。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>实时性\u003C\u002Fstrong>：ZooKeeper 支持事件通知机制，允许客户端实时接收到数据变化的通知。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>高可用性\u003C\u002Fstrong>：ZooKeeper 通常以集群形式部署，可以容忍部分节点的故障，只要集群中超过半数的节点是可用的，ZooKeeper 就能继续提供服务。\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>ZooKeeper 的数据模型：\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>ZooKeeper 使用一个层次化的命名空间来组织数据，类似于文件系统中的目录树。每个节点（称为 znode）都可以有子节点，形成树状结构。每个 znode 可以存储一定量的数据，并且可以设置访问控制列表（ACL）来控制谁可以读取或修改数据。\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>ZooKeeper 的应用场景：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>配置管理\u003C\u002Fstrong>：ZooKeeper 可以用来集中存储和管理分布式系统中的配置信息，当配置发生变化时，可以实时通知到所有客户端。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>命名服务\u003C\u002Fstrong>：ZooKeeper 可以作为服务发现的注册中心，帮助客户端查找和定位服务。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>集群管理\u003C\u002Fstrong>：ZooKeeper 可以用于选举主节点、检测集群成员的变化、以及监控集群的健康状况。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>分布式锁\u003C\u002Fstrong>：ZooKeeper 提供了一种机制来实现分布式环境下的互斥访问，保证多个进程之间数据操作的正确性。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>队列管理\u003C\u002Fstrong>：ZooKeeper 可以用来实现分布式队列，如任务调度队列或消息队列。\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>下载镜像\u003C\u002Fh2>\n\u003Cp>打开命令行工具，执行如下命令，拉取 Zookeeper 镜像：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>docker pull zookeeper:3.5.6\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172292942840796.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Ch2>创建挂载文件夹\u003C\u002Fh2>\n\u003Cp>镜像下载完成后，在 \u003Ccode>E:\u002Fdocker\u002F\u003C\u002Fcode>  目录下创建 \u003Ccode>\u002Fzookeeper\u003C\u002Fcode> 文件夹，用于存放等会启动容器时，挂载出容器内 Zookeeper 的相关配置文件，以及相关持久化数据：\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172292956928182.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Ch2>运行容器\u003C\u002Fh2>\n\u003Cp>执行如下命令，运行一个 Zookeeper 容器：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>docker run -d --name zookeeper -p 2181:2181 -e TZ=&quot;Asia\u002FShanghai&quot; -v E:\\docker\\zookeeper\\data:\u002Fdata -v E:\\docker\\zookeeper\\conf:\u002Fconf zookeeper:3.5.6\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172292969728683.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>解释一下这条命令的各项参数：\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>\u003Ccode>docker run\u003C\u002Fcode>\u003C\u002Fstrong>: 这是启动一个新的 Docker 容器的命令。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-d\u003C\u002Fcode>\u003C\u002Fstrong>: 这个选项表示以守护进程模式（即后台）运行容器。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>--name zookeeper\u003C\u002Fcode>\u003C\u002Fstrong>: 给容器指定一个名字叫做 \u003Ccode>zookeeper\u003C\u002Fcode>。这可以帮助你更容易地识别和管理这个容器。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-p 2181:2181\u003C\u002Fcode>\u003C\u002Fstrong>: 这是一个端口映射选项，它将宿主机的 \u003Ccode>2181\u003C\u002Fcode> 端口映射到容器内的 \u003Ccode>2181\u003C\u002Fcode> 端口。这意味着在宿主机上，你可以通过访问 \u003Ccode>localhost:2181\u003C\u002Fcode> 来连接到运行在容器内的 ZooKeeper 服务。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-e TZ=&quot;Asia\u002FShanghai&quot;\u003C\u002Fcode>\u003C\u002Fstrong>: 这个环境变量设置将容器内部的时间区域设为上海时区（亚洲\u002F上海）。这样可以确保容器内的时间与你的本地时区一致。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-v E:\\docker\\zookeeper\\data:\u002Fdata\u003C\u002Fcode>\u003C\u002Fstrong>: 这是一个卷挂载选项，将宿主机上的 \u003Ccode>E:\\docker\\zookeeper\\data\u003C\u002Fcode> 目录挂载到容器内的 \u003Ccode>\u002Fdata\u003C\u002Fcode> 目录。通常，ZooKeeper 将数据存储在 \u003Ccode>\u002Fdata\u003C\u002Fcode> 目录下，因此这个挂载点可以让你在宿主机上持久化 ZooKeeper 的数据。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-v E:\\docker\\zookeeper\\conf:\u002Fconf\u003C\u002Fcode>\u003C\u002Fstrong>: 类似于上面的挂载，这里将宿主机上的 \u003Ccode>E:\\docker\\zookeeper\\conf\u003C\u002Fcode> 目录挂载到容器内的 \u003Ccode>\u002Fconf\u003C\u002Fcode> 目录。ZooKeeper 的配置文件一般位于 \u003Ccode>\u002Fconf\u003C\u002Fcode> 目录下，这样你可以在宿主机上编辑配置文件，而不会影响到容器重启后的配置。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>zookeeper:3.5.6\u003C\u002Fcode>\u003C\u002Fstrong>: 这是指定使用的 Docker 镜像，这里是 ZooKeeper 版本 \u003Ccode>3.5.6\u003C\u002Fcode> 的镜像。\u003C\u002Fli>\n\u003C\u002Fol>\n\u003C\u002Fblockquote>\n\u003Cp>容器运行成功后，可通过 \u003Ccode>docker ps\u003C\u002Fcode> 命令查看正在运行中的容器，确认一下 Zookeeper 是否启动成功了：\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293059599615.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Ch2>进入 Zookeeper\u003C\u002Fh2>\n\u003Cp>执行如下命令，进入到 Zookeeper 容器中：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>docker exec -it zookeeper bash\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>接着，执行如下命令，来启动 ZooKeeper 的命令行界面（CLI），它允许用户直接与 ZooKeeper 服务器进行交互：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>.\u002Fbin\u002FzkCli.sh\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>连接成功后，效果图如下：\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293071167175.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003Ch2>zk 基本命令\u003C\u002Fh2>\n\u003Cp>ZooKeeper CLI (zkCli) 是 ZooKeeper 分布式协调服务附带的一个命令行工具，它提供了与 ZooKeeper 服务器交互的方式。使用 zkCli，你可以执行诸如查看、创建、修改和删除 ZooKeeper 中的数据节点（znodes）的操作。\u003C\u002Fp>\n\u003Cp>接下来，我们来学习一下 Zookeeper 的基础命令：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>ls\u003C\u002Fcode>\u003C\u002Fstrong>：列出当前路径下的子节点。如：查看根节点的子节点，命令如下：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>ls \u002F\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293458502546.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>create\u003C\u002Fcode>\u003C\u002Fstrong>：创建一个新的节点 （znode）。命令如下：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>create \u002FmyNode &quot;张三的专栏&quot;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>以上命令，将创建一个名为 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 的节点，并初始化其数据为 \u003Ccode>&quot;张三的专栏&quot;\u003C\u002Fcode>。\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293471667281.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>get\u003C\u002Fcode>\u003C\u002Fstrong>：获取指定节点的数据和状态信息。命令如下：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>get \u002FmyNode\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293475812388.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>set\u003C\u002Fcode>\u003C\u002Fstrong>：设置指定节点的数据。命令如下：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>set \u002FmyNode &quot;张三的专栏更新啦&quot;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>以上命令，将会把 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 的数据更改为 \u003Ccode>&quot;张三的专栏更新啦&quot;\u003C\u002Fcode>。\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293486850647.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>delete\u003C\u002Fcode>\u003C\u002Fstrong>：删除指定的节点（znode） 。命令如下：\u003C\u002Fp>\n\u003Cpre>\u003Ccode>delete \u002FmyNode\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>以上命令，将删除 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 节点，注意，只有当该节点没有子节点时才有效。\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293491640788.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>quit\u003C\u002Fcode>\u003C\u002Fstrong>：退出 zkCli 命令行工具。效果如下：\u003C\u002Fp>\n\u003Cp>\n\u003Cimg src=\"\u002Fupload\u002F172293495767392.jpg\" loading=\"lazy\">\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Ful>\n13:T316d,\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293048784392.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Cp>上小节\u003Cspan>\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" style=\"color: #aaa; margin-left: 3px;\" aria-hidden=\"true\" focusable=\"false\" x=\"0px\" y=\"0px\" viewBox=\"0 0 100 100\" width=\"15\" height=\"15\" class=\"icon outbound\">\u003Cpath fill=\"currentColor\" d=\"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z\">\u003C\u002Fpath> \u003Cpolygon fill=\"currentColor\" points=\"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9\">\u003C\u002Fpolygon>\u003C\u002Fsvg> \u003Cspan class=\"sr-only\">\u003C\u002Fspan>\u003C\u002Fspan>中，我们已经测试了美团 \u003Ccode>Leaf-segment\u003C\u002Fcode> 号段模式（依赖数据库）来获取分布式 ID ,  除了该模式外，还有 \u003Ccode>Leaf-snowflake\u003C\u002Fcode>  （基于雪花算法）模式，它依赖于 Zookeeper , 所以，本小节的内容是，在本地通过 Docker 将单机版的 Zookeeper 环境搭建好。\u003C\u002Fp>\n\u003Ch2 id=\"toc-0\">Zookeeper 介绍\u003C\u002Fh2>\n\u003Cp>Apache ZooKeeper 是一个开源的分布式协调服务，用于大型分布式系统的开发和管理。它提供了一种简单而统一的方法来解决分布式应用中常见的协调问题，如命名服务、配置管理、集群管理、组服务、分布式锁、队列管理等。ZooKeeper 通过提供一种类似文件系统的结构来存储数据，并允许客户端通过简单的 API 进行读写操作，从而简化了分布式系统的复杂度。\u003C\u002Fp>\n\u003Cp>Zookeeper 的核心特性如下：\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>一致性\u003C\u002Fstrong>：对于任何更新，所有客户端都将看到相同的数据视图。这是通过 ZooKeeper 的原子性保证的，意味着所有更新要么完全成功，要么完全失败。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>可靠性\u003C\u002Fstrong>：一旦数据被提交，它将被持久化存储，即使在某些服务器出现故障的情况下，数据也不会丢失。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>实时性\u003C\u002Fstrong>：ZooKeeper 支持事件通知机制，允许客户端实时接收到数据变化的通知。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>高可用性\u003C\u002Fstrong>：ZooKeeper 通常以集群形式部署，可以容忍部分节点的故障，只要集群中超过半数的节点是可用的，ZooKeeper 就能继续提供服务。\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>ZooKeeper 的数据模型：\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>ZooKeeper 使用一个层次化的命名空间来组织数据，类似于文件系统中的目录树。每个节点（称为 znode）都可以有子节点，形成树状结构。每个 znode 可以存储一定量的数据，并且可以设置访问控制列表（ACL）来控制谁可以读取或修改数据。\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>ZooKeeper 的应用场景：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>配置管理\u003C\u002Fstrong>：ZooKeeper 可以用来集中存储和管理分布式系统中的配置信息，当配置发生变化时，可以实时通知到所有客户端。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>命名服务\u003C\u002Fstrong>：ZooKeeper 可以作为服务发现的注册中心，帮助客户端查找和定位服务。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>集群管理\u003C\u002Fstrong>：ZooKeeper 可以用于选举主节点、检测集群成员的变化、以及监控集群的健康状况。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>分布式锁\u003C\u002Fstrong>：ZooKeeper 提供了一种机制来实现分布式环境下的互斥访问，保证多个进程之间数据操作的正确性。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>队列管理\u003C\u002Fstrong>：ZooKeeper 可以用来实现分布式队列，如任务调度队列或消息队列。\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"toc-1\">下载镜像\u003C\u002Fh2>\n\u003Cp>打开命令行工具，执行如下命令，拉取 Zookeeper 镜像：\u003C\u002Fp>\n\u003Cdiv class=\"language-text\" data-ext=\"text\" data-code=\"docker%20pull%20zookeeper%3A3.5.6%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-text\">docker pull zookeeper:3.5.6\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172292942840796.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Ch2 id=\"toc-2\">创建挂载文件夹\u003C\u002Fh2>\n\u003Cp>镜像下载完成后，在 \u003Ccode>E:\u002Fdocker\u002F\u003C\u002Fcode>  目录下创建 \u003Ccode>\u002Fzookeeper\u003C\u002Fcode> 文件夹，用于存放等会启动容器时，挂载出容器内 Zookeeper 的相关配置文件，以及相关持久化数据：\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172292956928182.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Ch2 id=\"toc-3\">运行容器\u003C\u002Fh2>\n\u003Cp>执行如下命令，运行一个 Zookeeper 容器：\u003C\u002Fp>\n\u003Cdiv class=\"language-dockerfile\" data-ext=\"dockerfile\" data-code=\"docker%20run%20-d%20--name%20zookeeper%20-p%202181%3A2181%20-e%20TZ%3D%22Asia%2FShanghai%22%20-v%20E%3A%5Cdocker%5Czookeeper%5Cdata%3A%2Fdata%20-v%20E%3A%5Cdocker%5Czookeeper%5Cconf%3A%2Fconf%20zookeeper%3A3.5.6%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-dockerfile\">docker run -d --name zookeeper -p 2181:2181 -e TZ=\"Asia\u002FShanghai\" -v E:\\docker\\zookeeper\\data:\u002Fdata -v E:\\docker\\zookeeper\\conf:\u002Fconf zookeeper:3.5.6\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172292969728683.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>解释一下这条命令的各项参数：\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>\u003Ccode>docker run\u003C\u002Fcode>\u003C\u002Fstrong>: 这是启动一个新的 Docker 容器的命令。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-d\u003C\u002Fcode>\u003C\u002Fstrong>: 这个选项表示以守护进程模式（即后台）运行容器。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>--name zookeeper\u003C\u002Fcode>\u003C\u002Fstrong>: 给容器指定一个名字叫做 \u003Ccode>zookeeper\u003C\u002Fcode>。这可以帮助你更容易地识别和管理这个容器。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-p 2181:2181\u003C\u002Fcode>\u003C\u002Fstrong>: 这是一个端口映射选项，它将宿主机的 \u003Ccode>2181\u003C\u002Fcode> 端口映射到容器内的 \u003Ccode>2181\u003C\u002Fcode> 端口。这意味着在宿主机上，你可以通过访问 \u003Ccode>localhost:2181\u003C\u002Fcode> 来连接到运行在容器内的 ZooKeeper 服务。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-e TZ=&quot;Asia\u002FShanghai&quot;\u003C\u002Fcode>\u003C\u002Fstrong>: 这个环境变量设置将容器内部的时间区域设为上海时区（亚洲\u002F上海）。这样可以确保容器内的时间与你的本地时区一致。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-v E:\\docker\\zookeeper\\data:\u002Fdata\u003C\u002Fcode>\u003C\u002Fstrong>: 这是一个卷挂载选项，将宿主机上的 \u003Ccode>E:\\docker\\zookeeper\\data\u003C\u002Fcode> 目录挂载到容器内的 \u003Ccode>\u002Fdata\u003C\u002Fcode> 目录。通常，ZooKeeper 将数据存储在 \u003Ccode>\u002Fdata\u003C\u002Fcode> 目录下，因此这个挂载点可以让你在宿主机上持久化 ZooKeeper 的数据。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>-v E:\\docker\\zookeeper\\conf:\u002Fconf\u003C\u002Fcode>\u003C\u002Fstrong>: 类似于上面的挂载，这里将宿主机上的 \u003Ccode>E:\\docker\\zookeeper\\conf\u003C\u002Fcode> 目录挂载到容器内的 \u003Ccode>\u002Fconf\u003C\u002Fcode> 目录。ZooKeeper 的配置文件一般位于 \u003Ccode>\u002Fconf\u003C\u002Fcode> 目录下，这样你可以在宿主机上编辑配置文件，而不会影响到容器重启后的配置。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>zookeeper:3.5.6\u003C\u002Fcode>\u003C\u002Fstrong>: 这是指定使用的 Docker 镜像，这里是 ZooKeeper 版本 \u003Ccode>3.5.6\u003C\u002Fcode> 的镜像。\u003C\u002Fli>\n\u003C\u002Fol>\n\u003C\u002Fblockquote>\n\u003Cp>容器运行成功后，可通过 \u003Ccode>docker ps\u003C\u002Fcode> 命令查看正在运行中的容器，确认一下 Zookeeper 是否启动成功了：\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293059599615.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Ch2 id=\"toc-4\">进入 Zookeeper\u003C\u002Fh2>\n\u003Cp>执行如下命令，进入到 Zookeeper 容器中：\u003C\u002Fp>\n\u003Cdiv class=\"language-sql\" data-ext=\"sql\" data-code=\"docker%20exec%20-it%20zookeeper%20bash%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-sql\">docker \u003Cspan class=\"token keyword\">exec\u003C\u002Fspan> \u003Cspan class=\"token operator\">-\u003C\u002Fspan>it zookeeper bash\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>接着，执行如下命令，来启动 ZooKeeper 的命令行界面（CLI），它允许用户直接与 ZooKeeper 服务器进行交互：\u003C\u002Fp>\n\u003Cdiv class=\"language-bash\" data-ext=\"bash\" data-code=\".%2Fbin%2FzkCli.sh%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-bash\">.\u002Fbin\u002FzkCli.sh\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>连接成功后，效果图如下：\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293071167175.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003Ch2 id=\"toc-5\">zk 基本命令\u003C\u002Fh2>\n\u003Cp>ZooKeeper CLI (zkCli) 是 ZooKeeper 分布式协调服务附带的一个命令行工具，它提供了与 ZooKeeper 服务器交互的方式。使用 zkCli，你可以执行诸如查看、创建、修改和删除 ZooKeeper 中的数据节点（znodes）的操作。\u003C\u002Fp>\n\u003Cp>接下来，我们来学习一下 Zookeeper 的基础命令：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>ls\u003C\u002Fcode>\u003C\u002Fstrong>：列出当前路径下的子节点。如：查看根节点的子节点，命令如下：\u003C\u002Fp>\n\u003Cdiv class=\"language-bash\" data-ext=\"bash\" data-code=\"ls%20%2F%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-bash\">\u003Cspan class=\"token function\">ls\u003C\u002Fspan> \u002F\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293458502546.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>create\u003C\u002Fcode>\u003C\u002Fstrong>：创建一个新的节点 （znode）。命令如下：\u003C\u002Fp>\n\u003Cdiv class=\"language-sql\" data-ext=\"sql\" data-code=\"create%20%2FmyNode%20%22%E5%BC%A0%E4%B8%89%E4%B8%93%E6%A0%8F%22%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-sql\">\u003Cspan class=\"token keyword\">create\u003C\u002Fspan> \u003Cspan class=\"token operator\">\u002F\u003C\u002Fspan>myNode \u003Cspan class=\"token string\">\"张三的专栏\"\u003C\u002Fspan>\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>以上命令，将创建一个名为 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 的节点，并初始化其数据为 \u003Ccode>&quot;张三的专栏&quot;\u003C\u002Fcode>。\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293471667281.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>get\u003C\u002Fcode>\u003C\u002Fstrong>：获取指定节点的数据和状态信息。命令如下：\u003C\u002Fp>\n\u003Cdiv class=\"language-sql\" data-ext=\"sql\" data-code=\"get%20%2FmyNode%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-sql\">get \u003Cspan class=\"token operator\">\u002F\u003C\u002Fspan>myNode\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293475812388.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>set\u003C\u002Fcode>\u003C\u002Fstrong>：设置指定节点的数据。命令如下：\u003C\u002Fp>\n\u003Cdiv class=\"language-bash\" data-ext=\"bash\" data-code=\"set%20%2FmyNode%20%22%E5%BC%A0%E4%B8%89%E4%B8%93%E6%A0%8F%E6%9B%B4%E6%96%B0%E5%95%A6%22%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-bash\">\u003Cspan class=\"token builtin class-name\">set\u003C\u002Fspan> \u002FmyNode \u003Cspan class=\"token string\">\"张三的专栏更新啦\"\u003C\u002Fspan>\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>以上命令，将会把 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 的数据更改为 \u003Ccode>&quot;张三的专栏更新啦&quot;\u003C\u002Fcode>。\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293486850647.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>delete\u003C\u002Fcode>\u003C\u002Fstrong>：删除指定的节点（znode） 。命令如下：\u003C\u002Fp>\n\u003Cdiv class=\"language-javascript\" data-ext=\"javascript\" data-code=\"delete%20%2FmyNode%0A\">\n        \u003Cbutton class=\"vp-copy-code-button\" data-copy data-copied=\"已复制\" aria-label=\"复制代码\">\u003C\u002Fbutton>\n        \u003Cpre>\u003Ccode class=\"language-javascript\">\u003Cspan class=\"token keyword\">delete\u003C\u002Fspan> \u003Cspan class=\"token operator\">\u002F\u003C\u002Fspan>myNode\n\u003C\u002Fcode>\u003C\u002Fpre>\n      \u003C\u002Fdiv>\n\u003Cp>以上命令，将删除 \u003Ccode>\u002FmyNode\u003C\u002Fcode> 节点，注意，只有当该节点没有子节点时才有效。\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293491640788.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n\u003Cp>\u003Cstrong>\u003Ccode>quit\u003C\u002Fcode>\u003C\u002Fstrong>：退出 zkCli 命令行工具。效果如下：\u003C\u002Fp>\n\u003Cp>\n\u003Cdiv class=\"img-loading\">\u003Cimg src=\"\u002Fupload\u002F172293495767392.jpg\" loading=\"lazy\">\u003C\u002Fdiv>\n\u003C\u002Fp>"]