docker环境
1 2 3 4 5 6 7 8 9 10 11 12 13
| [root@wikifx2 ~] REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 0901fa9da894 10 days ago 132MB nginx latest 0901fa9da894 10 days ago 132MB alpine latest a24bb4013296 7 weeks ago 5.57MB centos 7 b5b4d78bc90c 2 months ago 203MB [root@wikifx2 ~] / / [root@wikifx2 ~] CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 173daf6285ba a24bb4013296 "/bin/sh" 9 seconds ago Up 8 seconds tender_ramanujan [root@wikifx2 ~]
|
查看源:
1 2 3
| / http://dl-cdn.alpinelinux.org/alpine/v3.12/main http://dl-cdn.alpinelinux.org/alpine/v3.12/community
|
修改源:
1 2 3 4
| / / http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/main http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/community
|
构建缓存:
安装依赖:
安装 .NET Core Runtime
1 2 3 4 5
| / core-runtime-3.1.6-linux-musl-x64.tar.gz
/ /
|
编写启动脚本:
1 2 3 4 5
| cd /wwwroot/ && /app/dotnet/dotnet WebApplication5.dll --urls http://0.0.0.0:8000 tail -f /etc/hosts
docker commit a35e206825ed wikifx_dotnet:v4 docker image save 7a4ab67f3701 > wikifx_dotnetv4.tar.gz
|
宿主机dotnet写的hello word项目:
1 2 3 4 5 6 7 8 9 10 11 12 13
| [root@wikifx2 ~] /wwwroot/ ├── a624669980.tar.gz ├── appsettings.Development.json ├── appsettings.json ├── WebApplication5 ├── WebApplication5.deps.json ├── WebApplication5.dll ├── WebApplication5.pdb ├── WebApplication5.runtimeconfig.json └── web.config
0 directories, 9 files
|
启动:
docker run -it -d -p 80:8000 -v /wwwroot:/wwwroot 7a4ab67f3701 /bin/sh /etc/init.sh