欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Docker运行dotnetcore

程序员文章站 2023-10-19 11:23:24
安装centos7 mini 安装 docker,参考 https://www.cnblogs.com/qgc1995/p/9553572.html @@@code yum install docker-ce #安装 19.0.3 @@# 拉取测试镜像 @@@code docker pull hel... ......

 

安装centos7 mini

安装 docker,参考

 

@@@code

yum install docker-ce

#安装 19.0.3

@@#

拉取测试镜像

@@@code

docker pull hello-world

[root@docker ~]# docker run hello-world

 

hello from docker!

this message shows that your installation appears to be working correctly.

 

to generate this message, docker took the following steps:

1. the docker client contacted the docker daemon.

2. the docker daemon pulled the "hello-world" image from the docker hub.

(amd64)

3. the docker daemon created a new container from that image which runs the

executable that produces the output you are currently reading.

4. the docker daemon streamed that output to the docker client, which sent it

to your terminal.

 

to try something more ambitious, you can run an ubuntu container with:

$ docker run -it ubuntu bash

 

share images, automate workflows, and more with a free docker id:

https://hub.docker.com/

 

for more examples and ideas, visit:

https://docs.docker.com/get-started/

 

@@#

 

 

拉取镜像

 

参考https://www.bbsmax.com/a/rnjw1e0bdq/

@@@code

docker pull mcr.microsoft.com/dotnet/core/sdk:2.2

docker images

docker run -itd --rm -p 80:80 --name core_test mcr.microsoft.com/dotnet/core/sdk:2.2

docker ps

docker attach core_test

# docker rm core_test

@@#

 

Docker运行dotnetcore

 

容器持久化与移除

Docker运行dotnetcore

 

进入docker执行命令

Docker运行dotnetcore

 

在vs2017中发布应用

 

 

 

@@@code

docker build -t test:1.0 . # 注意最后有一个小点.

docker run -itd -p 80:80 --name test test:1.0 #在浏览器中打开

@@#

 

dockerfile

@@@code

from mcr.microsoft.com/dotnet/core/sdk:2.2 as base

workdir /app

copy ./test /app

expose 80

 

 

entrypoint ["dotnet", "webapplication1.dll"]

@@#

Docker运行dotnetcore

Docker运行dotnetcore

 

 

Docker运行dotnetcore

 

可能发生的错误

Docker运行dotnetcore

 

 

防火墙操作 参考

@@@code

firewall-cmd --zone=public --add-port=3410-3420/tcp --permanent

firewall-cmd --zone=public --add-port=80/tcp --permanent

firewall-cmd --zone=public --add-port=5880/udp --permanent

firewall-cmd --zone=public --add-port=5881/tcp --permanent

firewall-cmd --zone=public --add-port=5000-5005/tcp --permanent

firewall-cmd --zone=public --add-port=7200/tcp --permanent

firewall-cmd --zone=public --add-port=6379/tcp --permanent

firewall-cmd –reload

firewall-cmd --permanent --list-port

@@#

posted @ 2019-08-07 15:31 秦秋随 views(...) comments(...) edit 收藏