修改遇到问题目录

This commit is contained in:
Bunny 2025-02-19 18:20:33 +08:00
parent 11e1cff698
commit d4e1a2ed83
28 changed files with 338 additions and 18 deletions

View File

@ -0,0 +1,27 @@
# 使用官方的 Nginx 镜像作为基础镜像
FROM nginx:1.27.3
# 删除默认的 Nginx 配置文件
RUN rm /etc/nginx/conf.d/default.conf
# 将自定义的 Nginx 配置文件复制到容器中
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 设置时区,构建镜像时执行的命令
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo "Asia/Shanghai" > /etc/timezone
# 创建一个目录来存放前端项目文件
WORKDIR /usr/share/nginx/html
# 将前端项目打包文件复制到 Nginx 的默认静态文件目录
COPY dist/ /usr/share/nginx/html
# 复制到nginx目录下
COPY dist/ /etc/nginx/html
# 暴露 Nginx 的默认端口
EXPOSE 80
#EXPOSE 443
# 自动启动 Nginx
CMD ["nginx", "-g", "daemon off;"]

View File

@ -0,0 +1,32 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 ;
listen [::]:80;
server_name localhost;
client_max_body_size 5M; # 最大文件上传设置
location / {
root /etc/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
# # 后端跨域请求
# location ~/api/ {
# proxy_pass http://172.17.0.1:8000;
# proxy_set_header Host $http_host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# }
error_page 404 404.html;
location = /50x.html {
root html;
}
}

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- 基础
dir:
order: 1

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- 基础
dir:
order: 1

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- 基础
dir:
order: 2

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- 基础
---

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Dcker
- Dcker-Compose
dir:

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Docker
- 安装
dir:

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Docker
---

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Git
---

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- 编辑器
- IDE
---

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Java
---

View File

@ -6,7 +6,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Java
- Spring

View File

@ -6,7 +6,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Java
- Spring

View File

@ -6,7 +6,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Java
- Spring
headerDepth: 4

View File

@ -6,7 +6,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Java
- utils
dir:

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Linux
---

View File

@ -7,7 +7,6 @@ category:
- 笔记
- 记录
- 学习
- 问题
- Linux
- 系统
---

View File

@ -0,0 +1,16 @@
---
title: Docker报错
index: true
icon: devicon:docker
headerDepth: 4
category:
- 笔记
- 记录
- 学习
- 问题
- Docker
dir:
order: 1
---
<Catalog />

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -0,0 +1,233 @@
# 由于未安装所需的特性无法启动操作xxxxx
![](./images/1739539464780-ffe41345-42a4-45ee-8404-eed7874ea539.png)
```shell
deploying WSL2 distributions
ensuring main distro is deployed: deploying "docker-desktop": importing WSL distro "由于未安装所需的特性,无法启动操作。 \r\n错误代码: Wsl/Service/RegisterDistro/CreateVm/HCS/HCS_E_SERVICE_NOT_AVAILABLE\r\n" output="docker-desktop": exit code: 4294967295: running WSL command wsl.exe C:\WINDOWS\System32\wsl.exe --import docker-desktop <HOME>\AppData\Local\Docker\wsl\main C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar --version 2: 由于未安装所需的特性,无法启动操作。
```
### 解决方案
#### 步骤一
打开下面三个功能,有的电脑没有**虚拟机平台**就不用管。
![](./images/1739539470839-fa493b00-1836-4297-aa70-5314a4314e77.png)
_**有的电脑是这样的**_打开这两个既可。
![](./images/1739539474033-f1c0936f-564e-4f0a-ae2f-ecdf3b681c7e.png)
#### 步骤二
看情况有的直接输入命令即可使用,有的需要先关闭之后打开,如果不行进行**步骤三**
**关闭**
```bash
dism.exe /Online /Enable-Feature /FeatureName:VirtualMachinePlatform /All
```
**打开**
```bash
# 如果输入时提示错误代码 86 删除后面的 /All
dism.exe /Online /Disable-Feature /FeatureName:VirtualMachinePlatform /All
# 错误86提示删除后面的 /All
dism.exe /Online /Disable-Feature /FeatureName:VirtualMachinePlatform
```
#### 步骤三
使用`Win`+`R`打开cmd窗口输入`services.msc`。定位到下面位置。注意是:`Hyper-V 主机计算服务`。
启动类型 选择 `手动`,然后再 `启动`就可以了;需要注意的是要开启`Hyper-V`服务参考**步骤一**
![](./images/1739539480075-e4bae595-f931-496e-a8c2-d959945300fc.png)
## 基础功能
### 安装和卸载
+ **安装 WSL**
```bash
wsl --install
```
这会安装 WSL 和默认的 Linux 发行版(通常是 Ubuntu
+ **安装特定 Linux 发行版**
```bash
wsl --install -d <发行版名称>
```
例如,安装 Ubuntu 20.04
```bash
wsl --install -d Ubuntu-20.04
```
+ **卸载 WSL**
```bash
wsl --unregister <发行版名称>
```
例如,卸载 Ubuntu
```bash
wsl --unregister Ubuntu
```
### 管理 WSL 发行版
+ **列出已安装的发行版**
```bash
wsl --list --verbose
```
或简写:
```bash
wsl -l -v
```
+ **设置默认发行版**
```bash
wsl --set-default <发行版名称>
```
例如,将 Ubuntu 设置为默认发行版:
```bash
wsl --set-default Ubuntu
```
+ **更改 WSL 版本**
```bash
wsl --set-version <发行版名称> <版本号>
```
例如,将 Ubuntu 设置为 WSL 2
```bash
wsl --set-version Ubuntu 2
```
### 启动和停止
+ **启动 WSL**
```bash
wsl
```
这会启动默认的 Linux 发行版。
+ **启动特定发行版**
```bash
wsl -d <发行版名称>
```
例如,启动 Ubuntu
```bash
wsl -d Ubuntu
```
+ **停止 WSL**
```bash
wsl --shutdown
```
这会停止所有正在运行的 WSL 发行版。
## 安装和导入导出
### **方法 1使用 **`wsl --import`** 命令手动指定安装位置**
1. **下载 Linux 发行版的根文件系统rootfs**
- 你可以从官方源或其他可信来源下载 Linux 发行版的根文件系统(通常是一个 `.tar.gz` 文件)。
- 例如Ubuntu 的根文件系统可以从 [Ubuntu Cloud Images](https://cloud-images.ubuntu.com/) 下载。
2. **使用 **`wsl --import`** 安装**
- 使用以下命令将 Linux 发行版安装到指定目录:
```bash
wsl --import <发行版名称> <安装路径> <根文件系统路径>
```
- 例如,将 Ubuntu 安装到 `D:\WSL\Ubuntu`
```bash
wsl --import Ubuntu D:\WSL\Ubuntu ubuntu-rootfs.tar.gz
```
3. **设置默认用户**
- 安装完成后,默认会以 root 用户登录。你可以通过以下命令设置默认用户:
```bash
<发行版名称> config --default-user <用户名>
```
- 例如,设置 Ubuntu 的默认用户为 `yourusername`
```bash
Ubuntu config --default-user yourusername
```
---
### **方法 2移动已安装的 WSL 发行版**
如果你已经安装了 WSL 发行版,但想将其移动到其他位置,可以按照以下步骤操作:
1. **导出 WSL 发行版**
- 使用以下命令导出当前的 WSL 发行版:
```bash
wsl --export <发行版名称> <导出文件路径>
```
- 例如,导出 Ubuntu 到 `D:\WSL\ubuntu.tar`
```bash
wsl --export Ubuntu D:\WSL\ubuntu.tar
```
2. **卸载当前的 WSL 发行版**
- 使用以下命令卸载当前的发行版:
```bash
wsl --unregister <发行版名称>
```
- 例如,卸载 Ubuntu
```bash
wsl --unregister Ubuntu
```
3. **导入 WSL 发行版到新位置**
- 使用以下命令将导出的发行版导入到新位置:
```bash
wsl --import <发行版名称> <安装路径> <导出文件路径>
```
- 例如,将 Ubuntu 导入到 `D:\WSL\Ubuntu`
```bash
wsl --import Ubuntu D:\WSL\Ubuntu D:\WSL\ubuntu.tar
```
4. **设置默认用户**
- 导入后,默认会以 root 用户登录。你可以通过以下命令设置默认用户:
```bash
<发行版名称> config --default-user <用户名>
```
- 例如,设置 Ubuntu 的默认用户为 `yourusername`
```bash
Ubuntu config --default-user yourusername
```

View File

@ -0,0 +1,16 @@
---
title: Docker问题
index: false
icon: devicon:docker
headerDepth: 4
category:
- 笔记
- 记录
- 学习
- 问题
- Docker
dir:
order: 1
---
<Catalog />

View File

@ -1,7 +1,7 @@
---
title: 遇到的问题
index: false
icon: streamline:web
icon: line-md:question
category:
- 笔记
- 记录

View File

@ -1,6 +1,6 @@
---
title: 前端库
index: false
index: true
icon: fluent:library-16-filled
category:
- 笔记

View File

@ -0,0 +1,12 @@
---
title: Web问题
index: false
icon: streamline:web
category:
- 笔记
- 记录
- 学习
- 问题
---
<Catalog />