\u5377\u4f1a\u4e00\u76f4\u5b58\u5728\uff0c\u76f4\u5230\u6ca1\u6709\u5bb9\u5668\u4f7f\u7528<\/strong><\/span><\/div>\n\u5728\u7528docker run \u547d\u4ee4\u7684\u65f6\u5019,\u53ef\u4f7f\u7528-v\u53c2\u6570\u6765\u6807\u8bb0\u53ef\u4ee5\u5728\u5bb9\u5668\u3002\u53ef\u4ee5\u591a\u6b21\u4f7f\u7528-v \u53c2\u6570\u521b\u5efa\u591a\u4e2a\u6570\u636e\u5377\u3002\u4e0b\u9762\u6211\u4f7f\u7528chao\u955c\u50cf\u521b\u5efa\u4e00\u4e2aaaa\u5bb9\u5668\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5377\u6302\u8f7d\u5230\u5bb9\u5668\u7684\/chao\u76ee\u5f55\uff1a<\/p>\n
[root@localhost ~]# docker run -d -it -P --name aaa -v \/chao chao\r\n6bda302f62f636281499e5e08d76353b934b3af1132ef85189bdfb35b729d96c\r\n[root@localhost ~]# docker attach aaa\r\n[root@6bda302f62f6 \/]# ls\r\nbin chao dev\tetc home lib\tlib64 lost+found media mnt opt proc root\trun sbin srv\tsys tmp usr var\r\n<\/pre>\n\u4f8b\u5982\u6211\u4eec\u8981\u628a\u672c\u673a\u7684chaols\u76ee\u5f55\u5206\u4eab\u5230\u5bb9\u5668\u7684\/chao\u76ee\u5f55\u4e0b<\/p>\n
[root@localhost ~]# mkdir chaols\r\n[root@localhost ~]# cd chaols\/\r\n[root@localhost chaols]# touch a b c\r\n[root@localhost chaols]# cd\r\n[root@localhost ~]# docker run -v \/root\/chaols:\/chao -it chao\r\n[root@4c214961267f \/]# ls\r\nbin chao dev\tetc home lib\tlib64 lost+found media mnt opt proc root\trun sbin srv\tsys tmp usr var\r\n[root@4c214961267f \/]# ls \/chao\/\r\na b c\r\n<\/pre>\n\u6570\u636e\u5377\u5bb9\u5668<\/strong><\/div>\n\u7528\u6237\u5982\u679c\u9700\u8981\u5728\u5bb9\u5668\u4e4b\u95f4\u5171\u4eab\u4e00\u4e9b\u6570\u636e\uff0c\u6b64\u65f6\u5c31\u53ef\u4ee5\u7528\u6570\u636e\u5377\u5bb9\u5668\uff0c\u6570\u636e\u5377\u5bb9\u5668\u5c31\u662f\u4e00\u4e2a\u666e\u901a\u5bb9\u5668\uff0c\u5c31\u662f\u7528\u5b83\u6765\u5b58\u653e\u5171\u4eab\u7684\u6570\u636e\u3002
\n\u73b0\u5728\u6211\u4eec\u521b\u5efachao1 chao2 \u5728aaa\u5bb9\u5668\u4e2d\u6302\u8f7d<\/p>\n
[root@localhost ~]# docker run -it --volumes-from aaa --name chao1 chao\r\n[root@b26d0044b084 \/]# ls\r\nbin chao dev\tetc home lib\tlib64 lost+found media mnt opt proc root\trun sbin srv\tsys tmp usr var\r\n[root@b26d0044b084 \/]# cd chao\/\r\n[root@b26d0044b084 chao]# ls\r\n[root@b26d0044b084 chao]# cd ..\r\n[root@b26d0044b084 \/]# [root@localhost ~]# \r\n[root@localhost ~]# docker run -it --volumes-from aaa --name chao2 chao\r\n[root@a8ade4de8d12 \/]# ls\r\nbin chao dev\tetc home lib\tlib64 lost+found media mnt opt proc root\trun sbin srv\tsys tmp usr var\r\n[root@a8ade4de8d12 \/]# cd chao\/\r\n[root@a8ade4de8d12 chao]# ls\r\n[root@a8ade4de8d12 chao]# mkdir aaa\r\n[root@a8ade4de8d12 chao]# [root@localhost ~]# \r\n[root@localhost ~]# docker ps -a\r\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\na8ade4de8d12 chao \"\/bin\/bash\" 17 seconds ago Up 16 seconds chao2\r\nb26d0044b084 chao \"\/bin\/bash\" 44 seconds ago Up 42 seconds chao1\r\n4c214961267f chao \"\/bin\/bash\" 7 minutes ago Up 7 minutes serene_bose\r\nd1d444fb5fa4 chao \"\/bin\/bash\" 9 minutes ago Created zealous_jones\r\n286446231b22 chao \"\/bin\/bash\" 10 minutes ago Created fervent_shirley\r\n6bda302f62f6 chao \"\/bin\/bash\" 14 minutes ago Up 14 minutes aaa\r\n[root@localhost ~]# docker attach a8ade4de8d12\r\n[root@a8ade4de8d12 chao]# ls\r\naaa\r\n[root@a8ade4de8d12 chao]# [root@localhost ~]# \r\n[root@localhost ~]# docker attach b26d0044b084\r\n[root@b26d0044b084 \/]# ls\r\nbin chao dev\tetc home lib\tlib64 lost+found media mnt opt proc root\trun sbin srv\tsys tmp usr var\r\n[root@b26d0044b084 \/]# ls \/chao\/\r\naaa\r\n<\/pre>\n\u7531\u6b64\u53ef\u89c1\u4ed6\u4eec\u90fd\u6709chao\u76ee\u5f55\u5e76\u4e14\u91cc\u9762\u6570\u636e\u4e00\u6837\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6570\u636e\u5377\u662f\u4e00\u4e2a\u53ef\u4f9b\u5bb9\u5668\u4f7f\u7528\u7684\u7279\u6b8a\u76ee\u5f55\uff0c\u4f7f\u7528\u7c7b\u4f3c\u4e8elinux\u5bf9\u76ee\u5f55\u6216\u8005\u6587\u4ef6\u8fdb\u884c\u64cd\u4f5c\u3002 \u5728\u7528docker run \u547d […]<\/p>\n","protected":false},"author":1469,"featured_media":174903,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-174893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=174893"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174893\/revisions"}],"predecessor-version":[{"id":175043,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174893\/revisions\/175043"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/174903"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=174893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=174893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=174893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}