安裝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,參考 https://www.cnblogs.com/qgc1995/p/9553572.html
@@@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://hub.docker.com/publishers/microsoftowner
參考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執行命令
在vs2017中發佈應用
https://www.cnblogs.com/rufus-hua/p/6742836.html
https://blog.csdn.net/sd7o95o/article/details/80809734
@@@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"]
@@#
可能發生的錯誤
防火牆操作 參考 https://blog.csdn.net/u013514928/article/details/80411110
@@@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
@@#