{"id":104,"date":"2024-12-25T20:22:30","date_gmt":"2024-12-25T12:22:30","guid":{"rendered":"http:\/\/www.jiabangou.site\/?p=104"},"modified":"2024-12-27T21:29:27","modified_gmt":"2024-12-27T13:29:27","slug":"linux-%e7%a6%bb%e7%ba%bf%e5%ae%89%e8%a3%85-docker%ef%bc%88%e9%aa%8c%e8%af%81%e5%8f%af%e8%a1%8c%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.luips.com\/index.php\/docker\/linux-%e7%a6%bb%e7%ba%bf%e5%ae%89%e8%a3%85-docker%ef%bc%88%e9%aa%8c%e8%af%81%e5%8f%af%e8%a1%8c%ef%bc%89\/","title":{"rendered":"Linux \u79bb\u7ebf\u5b89\u88c5 Docker\uff08\u9a8c\u8bc1\u53ef\u884c\uff09"},"content":{"rendered":"<h1>\u4e00\u3001\u5b89\u88c5 docker<\/h1>\n<h3>1. \u4e0b\u8f7d Docker \u5b89\u88c5\u5305<\/h3>\n<p><code>https:\/\/download.docker.com\/linux\/static\/stable\/x86_64\/<\/code><\/p>\n<h3>2. \u89e3\u538b\u5b89\u88c5\u5305<\/h3>\n<pre><code class=\"language-shell line-numbers\">tar -xvf docker-27.1.0.tgz\nmv docker\/* \/usr\/bin\/\n<\/code><\/pre>\n<h3>3. \u5c06 docker \u6ce8\u518c\u4e3a service \u670d\u52a1<\/h3>\n<pre><code class=\"language-shell line-numbers\">vim \/etc\/systemd\/system\/docker.service\n<\/code><\/pre>\n<p>docker.service<\/p>\n<pre><code class=\"language-service line-numbers\">[Unit]\nDescription=Docker Application Container Engine\nDocumentation=https:\/\/docs.docker.com\nAfter=network-online.target firewalld.service\nWants=network-online.target\n\n[Service]\nType=notify\n# ExecStart=\/usr\/bin\/dockerd\nExecStart=\/usr\/bin\/dockerd -H tcp:\/\/0.0.0.0:2375  -H unix:\/\/\/var\/run\/docker.sock\nExecReload=\/bin\/kill -s HUP $MAINPID\n# Having non-zero Limit*s causes performance problems due to accounting overhead\n# in the kernel. We recommend using cgroups to do container-local accounting.\nLimitNOFILE=infinity\nLimitNPROC=infinity\nLimitCORE=infinity\n# Uncomment TasksMax if your systemd version supports it.\n# Only systemd 226 and above support this version.\n#TasksMax=infinity\nTimeoutStartSec=0\n# set delegate yes so that systemd does not reset the cgroups of docker containers\nDelegate=yes\n# kill only the docker process, not all processes in the cgroup\nKillMode=process\n# restart the docker process if it exits prematurely\nRestart=on-failure\nStartLimitBurst=3\nStartLimitInterval=60s\n\n[Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n<h3>4. \u542f\u52a8docker<\/h3>\n<pre><code class=\"language-shell line-numbers\">chmod +x \/etc\/systemd\/system\/docker.service\nsystemctl daemon-reload\nsystemctl start docker\n<\/code><\/pre>\n<h3>5. \u67e5\u770b\u7248\u672c\u53f7<\/h3>\n<pre><code class=\"language-shell line-numbers\">systemctl status docker\ndocker -v\n<\/code><\/pre>\n<h3>6. \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/h3>\n<pre><code class=\"language-shell line-numbers\">systemctl enable docker.service\n<\/code><\/pre>\n<h1>\u4e8c\u3001\u955c\u50cf\u4fdd\u5b58\u548c\u52a0\u8f7d<\/h1>\n<h3>1. \u4fdd\u5b58\u955c\u50cf<\/h3>\n<pre><code class=\"language-shell line-numbers\">docker save -o \u955c\u50cf\u4fdd\u5b58\u7684\u540d\u5b57\u548c\u4f4d\u7f6e \u955c\u50cf\u540d:TAG\n\ndocker save -o nginx.tar nginx:latest\n<\/code><\/pre>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.luips.com\/wp-content\/uploads\/2024\/12\/wp_editor_md_98cf296f62dba9a7a60d6dbc1757c8a8.jpg\"><img decoding=\"async\" src=\"https:\/\/www.luips.com\/wp-content\/uploads\/2024\/12\/wp_editor_md_98cf296f62dba9a7a60d6dbc1757c8a8.jpg\" alt=\"\" \/><\/a><\/p>\n<h3>2. \u52a0\u8f7d\u955c\u50cf<\/h3>\n<pre><code class=\"language-shell line-numbers\">docker load -i \u955c\u50cf\u4fdd\u5b58\u7684\u540d\u5b57\u548c\u4f4d\u7f6e\n\ndocker load -i nginx.tar\n<\/code><\/pre>\n<h1>\u4e09\u3001\u5b89\u88c5 docker-compose<\/h1>\n<h3>1. \u4e0b\u8f7d\u5e76\u4e0a\u4f20\u6587\u4ef6<\/h3>\n<p><code>https:\/\/github.com\/docker\/compose\/releases\/download\/v2.27.1\/docker-compose-linux-x86_64<\/code><\/p>\n<pre><code class=\"language-shell line-numbers\">\u4e0a\u4f20 docker-compose \u6587\u4ef6\u5230 \/usr\/local\/bin\/docker-compose\n<\/code><\/pre>\n<h3>2. \u4fee\u6539\u6743\u9650<\/h3>\n<pre><code class=\"language-shell line-numbers\">chmod +x \/usr\/local\/bin\/docker-compose\n<\/code><\/pre>\n<h3>3. \u521b\u5efa\u8f6f\u8fde\u63a5<\/h3>\n<pre><code class=\"language-shell line-numbers\">ln -s \/usr\/local\/bin\/docker-compose \/usr\/bin\/docker-compose\n<\/code><\/pre>\n<h3>4. \u67e5\u770b\u7248\u672c<\/h3>\n<pre><code class=\"language-shell line-numbers\">docker-compose --version\n<\/code><\/pre>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/blog.csdn.net\/baihaibo1024\/article\/details\/142254116<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5b89\u88c5 docker 1. \u4e0b\u8f7d Docker \u5b89\u88c5\u5305 h&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[20,22,21],"class_list":["post-104","post","type-post","status-publish","format-standard","hentry","category-docker","tag-centos","tag-docker","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":0,"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.luips.com\/index.php\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}