Running Dotnet aspnet 1.1 in a Docker container on OSX without any Windows
Prerequisite
Create Dockerfile
Create a file named Dockerfile in a new folder.
Its contents are:
1 2 3 4 5 6 7 8 | FROM microsoft/dotnet # VOLUME /Documents/Docker/dnc EXPOSE 80 ENV "ASPNETCORE_URLS=http://+:80" RUN mkdir app WORKDIR /app RUN dotnet new -t web RUN dotnet restore |
Create image
1 | docker build -t yournick/yourimagename . |
Run image
1 2 3 | docker run -p 80:80 \ -ti --rm yournick/yourimagename \ /bin/bash -c 'dotnet run' |
See output
On the host:
1 | curl localhost |
and you should se a whole dab of HTMl. You can also watch it in your browser.
Tags: asp.net core, asp.net-core 1.1, container, docker, dotnet core, OSX