zoukankan      html  css  js  c++  java
  • docker for windows & dotnet core app

    Step 1: 安装docker for windows

    Step 2: 从github 上 clone 源代码:https://github.com/dotnet/dotnet-docker-samples/

    Step 3: 进入项目跟目录,运行docker build命令。

    Step 4: build结束后使用 docker images 命令,查看生成的image

    Step 5: 通过 docker run 命令 运行 image.

    Step 6: 通过 docker tag 命令生成要push到 remote registry上的image. 注意这个image的命名规范(必须包含registry的名字,这里是yxzhk/oats).

    Push to Azure Registry

    az acr login ****不能work时用docker login 代替。

    docker login <azure-container-registry-name>.azurecr.io --username <registry-username> --password <password> 

    Create Container from Azure Registry

    Docker File:

    FROM microsoft/dotnet:2.0-sdk AS build-env
    WORKDIR /app
    
    # copy csproj and restore as distinct layers
    
    COPY *.csproj ./
    RUN dotnet restore
    
    
    
    # copy everything else and build
    COPY . ./
    RUN dotnet publish -c Release -o out
    
    
    # build runtime image
    FROM microsoft/dotnet:2.0-runtime 
    WORKDIR /app
    COPY --from=build-env /app/out ./
    
    ENTRYPOINT ["dotnet", "HelloContainer.dll"]
    

    docker ignore file:  

    bin/
    obj/

    PS: Docker 命令

    https://docs.docker.com/engine/reference/commandline/docker/

  • 相关阅读:
    继承
    反射
    DOS使用笔记
    [LeetCode] Merge Intervals
    [LeetCode] Insert Interval
    [LeetCode] Permutation Sequence
    [LeetCode] Rotate List
    [LeetCode] Text Justification
    [LeetCode] Simplify Path(可以不用看)
    [LeetCode] Edit Distance(很好的DP)
  • 原文地址:https://www.cnblogs.com/1zhk/p/7094941.html
Copyright © 2011-2022 走看看