. NET core Build Docker image

Source: Internet
Author: User
Tags dotnet docker run

1. Create. NET core Web project 2, add a dockerfile file
# 基于microsoft/dotnet:2.1-aspnetcore-runtime构建Docker ImageFROM microsoft/dotnet:2.1-aspnetcore-runtime # 设置工作路径WORKDIR /build # 拷贝文件COPY . . # 向外界暴露80端口EXPOSE 80 # 执行dotnet TestCore.dll命令ENTRYPOINT ["dotnet", "docker-core.dll"]
Command-line actions 3, Publish Web project folder, copy to Linux system
#命令行生成镜像docker build corewebapp -t company/corewebapp#在项目中标记镜像docker tag company/corewebapp 192.168.x.x/company/corewebapp#推送镜像到当前项目docker push 192.168.x.x/company/corewebappdocker images#REPOSITORY                          TAG                      IMAGE ID            CREATED             SIZE#192.168.x.x/company/corewebapp   latest                   38936668f8cb        2 minutes ago       258MB#company/corewebapp                  latest                   38936668f8cb        2 minutes ago       258MB

4. Running the image
docker run -d -p 5000:80     --restart=always     --name corewebapp     company/corewebappdocker ps#CONTAINER ID  IMAGE               COMMAND                 CREATED        STATUS        PORTS                 NAMES#49c52c7c7a5b  company/corewebapp  "dotnet docker-core.…"  7 seconds ago  Up 6 seconds  0.0.0.0:5000->80/tcp  corewebapp

Access via http://192.168.x.x:5000.

Portainer Web Operations

Build a new image, Images

Upload the image to a private warehouse.

. NET core Build Docker image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.