docker run core

Program.cs to add

.UseUrls("http://*:5000")

Publish the system to a folder and create a Dockerfile.

FROM microsoft/aspnetcore:2.0 AS base
COPY / /app/
WORKDIR /app
EXPOSE 5000
ENTRYPOINT ["dotnet", "/app/test.dll"]

All ftp to the cloud server, and then docker build in the current directory. Note that there is a dot after the last space.

docker build -t test .

Execute docker images and you should see an image called test. Then you can run it.

docker run -it -p 8080:5000 test

-it means: enter temporary interactive mode, -p means port mapping. So run.

 

There are also some common commands for docker:

docker ps -a to view the instance

docker stop xxx stops an instance

docker rm xxxx delete an instance

docker rmi xxx delete an image

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325034990&siteId=291194637