Coder Social home page Coder Social logo

docker's Introduction

Docker

Get Started with Docker FROM microsoft/aspnetcore-build AS build WORKDIR /app

COPY *.csproj . RUN dotnet restore

COPY . .

RUN dotnet publish --output /app/ --configuration Release

FROM microsoft/aspnetcore AS final WORKDIR /app COPY --from=build /app . ENTRYPOINT [ "dotnet", "TestProject.dll" ]


FROM microsoft/aspnetcore-build WORKDIR /app

COPY publish .

ENTRYPOINT [ "dotnet", "TestProject.dll" ]

Working steps to map publish folder to container

  1. dockerfile

FROM microsoft/aspnetcore-build WORKDIR /app

ENTRYPOINT [ "dotnet", "TestProject.dll" ]

  1. command to build image docker build -t volume-test .

  2. run the container from image docker run -it -p 8001:80 -v D:/Projects/TestProject/publish:/app --name volume-test volume-test

  3. Result

D:\Projects\Test>docker build -t docker-test . Sending build context to Docker daemon 3.14MB Step 1/3 : FROM microsoft/aspnetcore-build AS base ---> e4e43a027c0b Step 2/3 : WORKDIR /app ---> Using cache ---> 004da0c50e7c Step 3/3 : ENTRYPOINT [ "dotnet", "Test.dll" ] ---> Running in 4808106b8898 Removing intermediate container 4808106b8898 ---> 03648c023ca4 Successfully built 03648c023ca4 Successfully tagged docker-test:latest SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

D:\Projects\Test>docker run -it -p 9001:80 -v D:\Projects\Test\publish:/app --name docker-test docker-test Hosting environment: Production Content root path: /app Now listening on: http://[::]:80

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.