Docker运行dotnetcore
安装centos7 mini
安装 docker,参考
yum install docker-ce
#安装 19.0.3
@@#
拉取测试镜像
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/
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执行命令
在vs2017中发布应用
docker build -t test:1.0 . # 注意最后有一个小点.
docker run -itd -p 80:80 --name test test:1.0 #在浏览器中打开
@@#
dockerfile
from mcr.microsoft.com/dotnet/core/sdk:2.2 as base
workdir /app
copy ./test /app
expose 80
entrypoint ["dotnet", "webapplication1.dll"]
@@#
可能发生的错误
防火墙操作 参考
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
@@#
上一篇: 花菜的清洗步骤是怎样的及做法