一定要给windows先创建软连接,不然系统盘会爆表的:
mklink /j .docker D:\Administrator\.docker
Win7安装Docker
Dockerfile
# FROM docker.tidebuy.net/dotnet/core/sdk:3.1 AS tools-install
# #RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace
# RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump
# #RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters FROM docker.tidebuy.net/dotnet/core/aspnet:3.1
WORKDIR /app COPY .ci/comic.ttf /usr/share/fonts/comic.ttf
COPY .ci/sources.list /etc/apt/sources.list
# COPY --from=tools-install /dotnetcore-tools /opt/dotnetcore-tools
# ENV PATH="/opt/dotnetcore-tools:${PATH}" RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf && \
apt-get update && \
apt-get install -y libgdiplus libc6-dev && \
ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* ARG APP_PATH
ARG MAIN_DLL
ARG PORT COPY ${APP_PATH} .
ENV MAIN_DLL=${MAIN_DLL} EXPOSE ${PORT} ENTRYPOINT ["sh", "-c","/usr/bin/dotnet /app/$MAIN_DLL"]
Windows7安装 docker-compose的过程
Install Docker Compose(官网)
https://github.com/feizeikesi/DotNetForDocker
https://github.com/jia237377144/DotNetForDocker
docker-compose.yml
# Please refer https://aka.ms/HTTPSinContainer on how to setup an https developer certificate for your ASP .NET Core service.
version: '3.4' services:
jlp_web:
image: jlp_web:1.0
build:
context: .
dockerfile: docker/Dockerfile
ports:
- 5000:7777
depends_on:
- jlp_db
networks:
- web
jlp_db:
image: mysql:5.7
networks:
- web
ports:
- 33306:3306
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_USER: admin
MYSQL_PASSWORD: 123456
MYSQL_DATABASE: dockerweb
restart: always
volumes:
- "./db/data:/var/lib/mysql"
- "./db/config:/etc/mysql/conf.d"
- "./sql:/docker-entrypoint-initdb.d"
networks:
web:
external: true
C:\Users\Administrator\.docker 目录下面添加daemon.json文件
daemon.json文件
{
"registry-mirrors" : [ "https://hub-mirror.c.163.com" ],
"insecure-registries" : [ "192.168.0.112:18080" ]
}