Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 298064b

Browse files
committed
docs(docker): 指定文件格式版本
1 parent 160c7e1 commit 298064b

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docs/docker/docker-compose/Compose版本依赖.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,30 @@ $ docker info | grep -i server | grep -i version
2020

2121
## 应用版本
2222

23-
直接使用最新版本的程序即可,参考[compose releases](https://github.com/docker/compose/releases/)
23+
直接使用最新版本的程序即可,参考[compose releases](https://github.com/docker/compose/releases/)
24+
25+
## 指定版本号
26+
27+
参考:[Compose file versions and upgrading](https://docs.docker.com/compose/compose-file/compose-versioning/)
28+
29+
在编写`docker-compose.yml`文件时需要指定文件格式版本
30+
31+
```
32+
version: "3.7"
33+
services:
34+
web:
35+
build: .
36+
ports:
37+
- "5000:5000"
38+
volumes:
39+
...
40+
...
41+
```
42+
43+
**注意:如果仅指定了主版本号(`3`),没有指定次版本号(`7`),默认添加`0`作为次版本号**
44+
45+
```
46+
version: "3"
47+
# 等价于
48+
version: "3.0"
49+
```

0 commit comments

Comments
 (0)