docker 发布到私有docker registry

时间:2022-09-13 19:26:45

1、使用vs发布项目到文件夹;

2、在文件夹中新建dockerfile文件,

内容:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

#因为项目中使用了System.Drawing.Common, 当发布到Linux 系统中, 需要安装libgdiplus libc6-dev
RUN apt-get update
RUN apt-get install -y --no-install-recommends libgdiplus libc6-dev

FROM base AS final
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "Idp.dll"]

3、docker build -t xxx.xxx.net:20000/imagename .          //最后有个.

4、docker push xxx.xxx.net:20000/imagename