forked from khs1994-docker/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows.md
87 lines (52 loc) · 2.27 KB
/
windows.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Windows 上安装
[![](https://img.shields.io/badge/AD-%E8%85%BE%E8%AE%AF%E4%BA%91%E5%AE%B9%E5%99%A8%E6%9C%8D%E5%8A%A1-blue.svg)](https://cloud.tencent.com/redirect.php?redirect=10058&cps_key=3a5255852d5db99dcd5da4c72f05df61) [![](https://img.shields.io/badge/Support-%E8%85%BE%E8%AE%AF%E4%BA%91%E8%87%AA%E5%AA%92%E4%BD%93-brightgreen.svg)](https://cloud.tencent.com/developer/support-plan?invite_code=13vokmlse8afh)
打开 `PowerShell`
```powershell
$ cd $HOME
$ git clone --depth=1 https://github.com/khs1994-docker/lnmp.git
# $ git clone --depth=1 [email protected]:khs1994-docker/lnmp.git
# 中国镜像
$ git clone --depth=1 https://gitee.com/khs1994-docker/lnmp.git
# $ git clone --depth=1 [email protected]:khs1994-docker/lnmp
```
## 设置环境变量
```powershell
$ [environment]::SetEnvironmentvariable("LNMP_PATH", "${HOME}\lnmp", "User")
```
## 启动 Demo
```powershell
$ cd $HOME
$ cd lnmp
$ ./lnmp-docker.ps1 up
```
> 如果 `PoswerShell` 禁止执行脚本,请以管理员身份执行 `set-ExecutionPolicy Bypass`,之后输入 `Y` 确认。[说明](https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-6)
浏览器打开 `127.0.0.1`,看到页面。
## WSL
**在 WSL 执行 Docker CLI 命令,不是在 WSL 运行 Docker 服务端**
> 不建议使用,请使用 [WSL2](https://github.com/khs1994-docker/lnmp/blob/19.03/wsl2/README.DOCKER.md)
* https://github.com/khs1994-docker/lnmp/blob/master/wsl/config/wsl.conf
默认的 WSL 将 C 盘挂载到了 `/mnt/c`,这里修改配置,将 C 盘挂载到 `/c`
### 1. 设置 Windows PATH 变量
```powershell
$ [environment]::SetEnvironmentvariable("Path", "$env:Path;$env:LNMP_PATH\windows;$env:LNMP_PATH\wsl", "User")
```
### 2. 安装 Docker CLI/ docker-compose
WSL 中执行
```bash
$ lnmp-wsl-docker-cli.sh
```
### 3. 设置挂载路径
* https://raw.githubusercontent.com/khs1994-docker/lnmp/master/wsl/config/wsl.conf
WSL 中执行
```bash
$ sudo vim /etc/wsl.conf
[automount]
enabled = true
root = /
```
### 4. 使用
```bash
$ wsl -- ./lnmp-docker
```
## [WSL2](https://github.com/khs1994-docker/lnmp/blob/19.03/wsl2/README.DOCKER.md)
由于 Docker 桌面版启动时间较长,经常出现问题(无法启动),本项目支持 WSL2 Docker。