mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 16:37:34 +00:00
Fix guide issues
This commit is contained in:
@@ -5,12 +5,12 @@ VS Code 的 [Dev Containers](https://code.visualstudio.com/docs/devcontainers/co
|
||||
|
||||
本节提供一个最小可用示例:把任意项目(以 Go 为例)变成“打开即开发”的容器化环境。
|
||||
|
||||
## 21.6.1 前置条件
|
||||
### 21.6.1 前置条件
|
||||
|
||||
* 安装 Docker Desktop(或 Linux 上的 Docker Engine)。
|
||||
* VS Code 安装扩展:Dev Containers(`ms-vscode-remote.remote-containers`)。
|
||||
|
||||
## 21.6.2 最小示例:.devcontainer/devcontainer.json
|
||||
### 21.6.2 最小示例:.devcontainer/devcontainer.json
|
||||
|
||||
在项目根目录创建 `.devcontainer/devcontainer.json`:
|
||||
|
||||
@@ -40,7 +40,7 @@ VS Code 会拉取镜像并启动容器,随后你就可以在容器内运行:
|
||||
go test ./...
|
||||
```
|
||||
|
||||
## 21.6.3 结合 Docker Compose(可选)
|
||||
### 21.6.3 结合 Docker Compose(可选)
|
||||
|
||||
如果项目同时依赖数据库/缓存(例如 Postgres/Redis),可以使用 `dockerComposeFile`
|
||||
把依赖一起拉起。
|
||||
|
||||
Reference in New Issue
Block a user