docker中文乱码
This commit is contained in:
BIN
docker/image-1.png
Normal file
BIN
docker/image-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
BIN
docker/image-2.png
Normal file
BIN
docker/image-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
BIN
docker/image.png
Normal file
BIN
docker/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
48
docker/setFonts.md
Normal file
48
docker/setFonts.md
Normal file
@ -0,0 +1,48 @@
|
||||
<h1>解决docker中文乱码</h1>
|
||||
|
||||
## 构建镜像
|
||||
|
||||
1. 编写Dockerfile
|
||||
```Dockerfile
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0
|
||||
WORKDIR /app #容器内的工作目录
|
||||
EXPOSE 80 #容器监听的端口
|
||||
ADD /Fonts/* /usr/share/fonts/ #中文字体
|
||||
ENV LANG=C.UTF-8 #容器默认编码
|
||||
ENTRYPOINT ["dotnet","RapidApp.Api.dll"]
|
||||
```
|
||||
|
||||
2. 构建命令
|
||||
```cmd
|
||||
docker build -t [imagesName] -f Dockerfile .
|
||||
```
|
||||
ps:命令要在Dockerfile在的目录下执行
|
||||
|
||||
## 添加容器
|
||||

|
||||
|
||||
## 查看容器字体
|
||||
1. 进入容器
|
||||
```cmd
|
||||
docker exec -it [containerName] bash
|
||||
```
|
||||

|
||||
|
||||
2. 查看字体
|
||||
* fc-list :查看所有字体
|
||||
* fc -list:lang-zh:查看中文字体
|
||||

|
||||
|
||||
3. 命令不起作用
|
||||
|
||||
如果出现以下信息
|
||||
```cmd
|
||||
bash: fc-list: command not found
|
||||
```
|
||||
|
||||
解决:
|
||||
```cmd
|
||||
apt-get update
|
||||
apt-get upgrade
|
||||
apt-get install fontconfig
|
||||
```
|
Reference in New Issue
Block a user