Docker 保留 windows 用户配置文件文件夹数据
Docker persist windows userprofile folder data
低于 Dockerfile 有效。目的是保留用户配置文件文件夹卷。
例如:windows
中的 C:\Users\INaBJOJ1\source
# escape=`
FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY . App/
WORKDIR /App
EXPOSE 44309
VOLUME ${USERPROFILE}\source\
RUN echo ${USERPROFILE}\source\
# RUN dir c:\
ENV ASPNETCORE_ENVIRONMENT="Development"
ENV ASPNETCORE_URLS="https://+:44309;"
ENTRYPOINT ["dotnet", "Service.dll"]
我在这里解释了已解决的版本 -
services:
directoryservice:
user: "ContainerAdministrator"
# build:
# context: .
# dockerfile: api-win.Dockerfile
# image: apiwin:latest
image: abcd.azurecr.io/api-windows:113133
ports:
- "44309:44309"
environment:
- COMPOSE_CONVERT_WINDOWS_PATHS=1
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_Kestrel__Certificates__Default__Password=123#
- ASPNETCORE_Kestrel__Certificates__Default__Path=C:\https\apicert.pfx
volumes:
- ./devops/https:C:\https:ro
- ${USERPROFILE}\source:C:\source:rw
低于 Dockerfile 有效。目的是保留用户配置文件文件夹卷。
例如:windows
中的 C:\Users\INaBJOJ1\source# escape=`
FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY . App/
WORKDIR /App
EXPOSE 44309
VOLUME ${USERPROFILE}\source\
RUN echo ${USERPROFILE}\source\
# RUN dir c:\
ENV ASPNETCORE_ENVIRONMENT="Development"
ENV ASPNETCORE_URLS="https://+:44309;"
ENTRYPOINT ["dotnet", "Service.dll"]
我在这里解释了已解决的版本 -
services:
directoryservice:
user: "ContainerAdministrator"
# build:
# context: .
# dockerfile: api-win.Dockerfile
# image: apiwin:latest
image: abcd.azurecr.io/api-windows:113133
ports:
- "44309:44309"
environment:
- COMPOSE_CONVERT_WINDOWS_PATHS=1
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_Kestrel__Certificates__Default__Password=123#
- ASPNETCORE_Kestrel__Certificates__Default__Path=C:\https\apicert.pfx
volumes:
- ./devops/https:C:\https:ro
- ${USERPROFILE}\source:C:\source:rw