<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://md5.pw/index.php?action=history&amp;feed=atom&amp;title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8</id>
	<title>Docker配置容器自启动 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://md5.pw/index.php?action=history&amp;feed=atom&amp;title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8"/>
	<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8&amp;action=history"/>
	<updated>2026-05-10T13:37:28Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://md5.pw/index.php?title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8&amp;diff=1723&amp;oldid=prev</id>
		<title>Wxy：​添加分类</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8&amp;diff=1723&amp;oldid=prev"/>
		<updated>2026-03-25T07:10:16Z</updated>

		<summary type="html">&lt;p&gt;添加分类&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年3月25日 (三) 00:10的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;第27行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第27行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;其他：如果想停止自动启动，运行以下命令：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;其他：如果想停止自动启动，运行以下命令：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;docker update --restart=no 容器名字或者容器ID&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;docker update --restart=no 容器名字或者容器ID&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:500 常见应用指南 — Application Guides]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wxy</name></author>
	</entry>
	<entry>
		<id>https://md5.pw/index.php?title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8&amp;diff=1722&amp;oldid=prev</id>
		<title>Wxy：​创建页面，内容为“== 如果服务器上需要这样的重启功能，可以有两种方法进行设置： == ==== 1.容器还没有创建 ==== 在运行容器的时候加入–restart=always参数：  docker run -id --restart=always -p 9999:9999 -v xxxx:xxxx 镜像名称:tag ==== 2.容器已经运行的情况，运行以下命令： ====  docker update --restart=always 容器名字或者容器ID  想立即生效就重启 docker systemctl restart docker , 不然就等到它下次…”</title>
		<link rel="alternate" type="text/html" href="https://md5.pw/index.php?title=Docker%E9%85%8D%E7%BD%AE%E5%AE%B9%E5%99%A8%E8%87%AA%E5%90%AF%E5%8A%A8&amp;diff=1722&amp;oldid=prev"/>
		<updated>2026-03-25T07:05:29Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“== 如果服务器上需要这样的重启功能，可以有两种方法进行设置： == ==== 1.容器还没有创建 ==== 在运行容器的时候加入–restart=always参数：  docker run -id --restart=always -p 9999:9999 -v xxxx:xxxx 镜像名称:tag ==== 2.容器已经运行的情况，运行以下命令： ====  docker update --restart=always 容器名字或者容器ID  想立即生效就重启 docker systemctl restart docker , 不然就等到它下次…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 如果服务器上需要这样的重启功能，可以有两种方法进行设置： ==&lt;br /&gt;
==== 1.容器还没有创建 ====&lt;br /&gt;
在运行容器的时候加入–restart=always参数：&lt;br /&gt;
 docker run -id --restart=always -p 9999:9999 -v xxxx:xxxx 镜像名称:tag&lt;br /&gt;
==== 2.容器已经运行的情况，运行以下命令： ====&lt;br /&gt;
 docker update --restart=always 容器名字或者容器ID&lt;br /&gt;
&lt;br /&gt;
想立即生效就重启 docker systemctl restart docker , 不然就等到它下次重启自动生效&lt;br /&gt;
&lt;br /&gt;
==== 3. docker-compose.yaml ====&lt;br /&gt;
Docker Compose 可以通过在 restart 字段中设置特定的值来实现自动重启容器的功能。&lt;br /&gt;
&lt;br /&gt;
可以使用如下几种值来设置自动重启策略：&lt;br /&gt;
&lt;br /&gt;
* always：总是重启容器。&lt;br /&gt;
* on-failure：当容器退出时，只有当退出码非 0 时才重启容器。&lt;br /&gt;
* unless-stopped：只有当容器已停止（没有使用 docker stop 命令停止）时，才不会重启容器。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
version: &amp;quot;3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
services:&lt;br /&gt;
  gotify:&lt;br /&gt;
    image: gotify/server&lt;br /&gt;
    restart: on-failure:3  &lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
其他：如果想停止自动启动，运行以下命令：&lt;br /&gt;
docker update --restart=no 容器名字或者容器ID&lt;/div&gt;</summary>
		<author><name>Wxy</name></author>
	</entry>
</feed>