原文:Docker + .NET Core(二)

前言:

环境:centos7.5 64 位

正文:

首先我们在宿主机上安装 .NET Core SDK

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
sudo yum update
sudo yum install libunwind libicu
sudo yum install dotnet-sdk-2.2

安装好之后,创建一个 .NET Core MVC的项目:

cd $HOME
mkdir demo
cd demo
#创建一个HelloDocker.Web的MVC项目
dotnet new mvc -n HelloDocker.Web
cd HelloDocker.Web
dotnet run

这个时候可能会报错,我一开始以为是IPV6的问题,后来发现并不是

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA5wAAABTCAYAAADz5AgtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACFpSURBVHhe7Z07cuNKrIbPHia58QkZTTw1G5hSfLbgKq3jFnNvQZtwMgu5gRfDC/SDRDe7AVAkbVn+g68ssV9oAP0Amxb/+Z///b/pn3/+Mbne/k5//yZu183pAAAAAAAAAAC+Gd6AEwAAAAAAAAAA2AQCTgAAAAAAAAAAp4CAEwAAAAAAAADAKSDgBAAAAAAAAABwCgg4AQAAAAAAAACcAgJOAAAAAAAAAACn8BwB55Bey3KbroO4fhmbr2m5jH+n23Uorn0lLuNteQUN9Xm8tPNt4zKNc51rne2Fdc71Zr0PV9GH8bLKfx9DoZvbeJ0u1M4x+jkC8tNCvnG6PckrhAp7hj4Jf/oqfczzBaHND0tfq/kmpLFNY9q6jkUnX3n+AQAAAADYxNOccA7X6cYbORG8cPBxu43TReb76nA/qU9DK4247u1vqJ8CNdJdvZney8oeqa06n4bWvyiz2MjTZ74R8SgBJwcqowg0hsv2/j8yoX9C18HeNB57vnoPu/3bA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AgFNAwAkAAAAAAAAA4BQQcAIAAAAAAAAAOJ5/pv8HQXI3jSA1o2AAAAAASUVORK5CYII=" alt="avatar">

vi Program.cs

加一句这个就可以了

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAAFDCAYAAAAOMwd3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACr0SURBVHhe7d0/trM40sDhiTt9s84660MwG2ElLISFeB1OvrjTyTrrbKLZgj+VQFASJQn/QfbFvz7n6fe6BEISYJXle+1/uf9uAAAAwJuYQQAAAKAFMwgAAAC0YAYBAACAFswgAAAA0IIZBAAAAFowgwAAAEALZhAAAABowQwCAAAALZhBAAAAoAUzCAAAALRgBgEAAIAWzCAAAADQghkEAAAAWjCDAAAAQAtmEAAAAGjBDAIAAAAtmEEAAACgBTMIAAAAtGAGAQAAgBbMILRuuF2u19vVGXv3uB/9z8tja5+U2ucydPeXl6j2LS7jre+MbR/Uj1Lv5Ta8sM59+tu49Gs6fjdcln7uGav3tR0AAOxgBpGQBChKPCV5HPtomz2knlICVSvPStsjCaokpHqbJw2XNyV0rm/bMeluo+tfF8Xy3tZ2AABQM//QD25yX1egxiEkNvPKlJv4p3KX4EhyMMeWZKdz2y37X2+XcUgShe42jGpFy/18uQy+bPD7uWRhmOsVru4oeci2L+huvar/6uoedQJSbV9ZNRndWf/jyWgyfq5/UaJpJMdxXZX9a+PnhIRO6tXb+X5W+j+tTrq4a08fzvPeZFkSa983l4DKfv5nOd50/UzblI/v266vITk2ySkAAJ8g/NDdOjU5S/KwJF/+beCQiMjbydNELslL2GYYk1UqSQ5cQhAeT4lRv2zTSfKkkglJSH0CsbTBJU9RslJon38sbVFJnBxfvTVba19NlICFhEcljXvrzyeb5fLNyp5PvlTCZSSjOlbbvzZ+ItThk8kkmdvVf2mPq1MSS38u3Tb6nGb5VV5Xl//XtVPavSSo0za14/sXPH4/Vb43GQYAAEeaf3CTe7Sy5H6Okl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AAAALRgBgEAAIAWzCAAAADQghkEAAAAWjCDh/AfWm182DcAAAC+lhk8TPmDrQEAAPBlzOBh5GsNSUYBAAAwM4OHIRkFAACAYgaP04+3y/V6uwydXQ4AAIBvYgYPw8ooAAAAFDN4GJJRAAAAKGbwMPw1PQAAABQzeAg+ZxQAAAAJMwgAAAC0YAYBAACAFswgAAAA0IIZBAAAAFowgwAAAEALZhAAAABowQwCAAAALZhBAAAAoAUzCAAAALRgBgEAAIAWzCAAAADQghkEAAAAWjCDAAAAQAtmEAAAAGjBDAIAAAAtmEEAAACgBTMIAAAAtGAGAQAAgBbMIAAAANCCGQQAAABaMIMAAABAC2YQAAAAaMEMAgAAAC2YQQAAAKAFMwgAAAC0YAYBAACA4/2yggAAAEAbZhAAAABowQwCAAAALZhBAAAAoAUzCAAAALRgBgEAAIAWzCAAAADQghkEAAAAWjCDAAAAQAtmEAAAAGjBDAIAAAAtmEEAAACgBTMIAAAAtGAGAQAAgBbMIAAAANCCGQQAAACO98sKAgAAAG2YQQAAAKAFMwgAAAC0YAYBAACAFswgAAAA0IIZBAAAAFowgwAAAEALZhAAAABowQwCAAAALZhBAAAAoAUzCAAAALRgBgEAAIAWzCAAAADQghkEAAAAWjCDAAAAQAtmEAAAADjeLysIAAAAtGEGAQAAgBbMIAAAANCCGQQAAABaMIMAAABAC2YQAAAAaMEMAgAAAC2YQQAAAKAFMwgAAAC0YAYBAACAFswgAAAA0IIZBAAAAA72r9v/A58LkvJ2Tj7/AAAAAElFTkSuQmCC" alt="avatar">

直接浏览器访问 http://IP:5000

然后关掉

这时访问不了 http://IP:5000

挂载到容器中

# `\`结合`Enter`键构成换行符,可以换行输入一个长命令。
#-it以交互模式(进入容器内部)
#-p参数端口映射
#-v参数挂载宿主机的文件到容器的指定目录 $HOME/demo/HelloDocker.Web文件夹下的文件挂载到容器的\app目录下。 docker run -it \
-p 5000:5000 \
-v $HOME/demo/HelloDocker.Web:/app \
microsoft/dotnet:latest

这一步可能会出错

WARNING: IPv4 forwarding is disabled

启用IPV4 IP的转发:

检查当前值:

/sbin/sysctl net.ipv4.conf.all.forwarding

启用设置:

/sbin/sysctl -w net.ipv4.conf.all.forwarding=1

检查输出docker info:

docker info

再重新执行上面的长命令,不报错,已经进入容器内

cd app
dotnet run

浏览器访问 http://IP:5000

成功

容器内部中的app目录下包含了宿主机上的源码项目。是以共享的形式,而不是宿主机的拷贝,在宿主机上对目录的更改会即时反应到容器中。但反过来,容器中对共享目录的更改不会反应到宿主机上,容器具有隔离特性。

Docker + .NET Core(二)的更多相关文章

  1. 【实战】Docker入门实践二:Docker服务基本操作 和 测试Hello World

    操作环境 操作系统:CentOS7.2 内存:1GB CPU:2核 Docker服务常用命令 docker服务操作命令如下 service docker start #启动服务 service doc ...

  2. ExpandoObject与DynamicObject的使用 RabbitMQ与.net core(一)安装 RabbitMQ与.net core(二)Producer与Exchange ASP.NET Core 2.1 : 十五.图解路由(2.1 or earler) .NET Core中的一个接口多种实现的依赖注入与动态选择看这篇就够了

    ExpandoObject与DynamicObject的使用   using ImpromptuInterface; using System; using System.Dynamic; names ...

  3. Docker学习(二): 镜像的使用与构建

    特别声明: 博文主要是学习过程中的知识整理,以便之后的查阅回顾.部分内容来源于网络(如有摘录未标注请指出).内容如有差错,也欢迎指正! =============系列文章============= 1 ...

  4. Docker+.Net Core 的那些事儿-1.准备工作

    1.下载centos 地址:https://www.centos.org/download/ 我使用的是DVD ISO,这么做的目的是为了在之后的docker填坑的路上,方便使用centos中Fire ...

  5. Docker+.Net Core 的那些事儿-2.创建Docker镜像

    1.从store.docker.com获取.net core镜像 docker pull microsoft/dotnet 2.创建一个.net core项目,并发布 在上篇文章结尾建立的工作目录下, ...

  6. Docker+.Net Core 的那些事儿-3.创建容器并运行

    1.根据镜像运行容器 上篇文章建立了一个镜像: 我们以此开始,执行以下命令: docker run -d -p 5000:5000 hwapp:latest 如果返回以上结果表示建立成功. 此时如果你 ...

  7. CentOS下Docker与.netcore(二) 之 Dockerfile

    CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.netcore(二) 之 Dockerfile CentOS下Docker与.netcore(三)之 三剑客 ...

  8. docker学习笔记二:常用命令

    docker学习笔记二:常用命令 查看docker常用命令 docker --help 返回结果如下: 其中常用的命令如下: 1.image相关操作 展示所有的image: 删除image: rmi ...

  9. Docker + .NET Core(三)-两种发布方式

    原文:Docker + .NET Core(三)-两种发布方式 第一种,自己手写dockerfile发布,上传至hubDocker 正常发布到文件夹中,发布文件上传至linux机器上.如 /www/a ...

随机推荐

  1. Cocos2d-x学习笔记(一)HelloWorld

    原创文章,转载请注明出处:http://blog.csdn.net/sfh366958228/article/details/38656755 前言 正式来公司实习已有一月,前一月主要是看了<C ...

  2. COCOS学习笔记--持续动作ActionInterval

    上一篇博客介绍了即时动作ActionInstant.与即时动作相对的是持续动作ActionInterval. 顾名思义,持续动作就是须要一段时间来持续运行的动作,而且在有限时间内改变运行对象的一些属性 ...

  3. WebApp调用手机相册或摄像头、拨打电话

    WebApp调用手机相册或摄像头.拨打电话 一.总结 一句话总结:input标签,指定type为file,选择好对应的accept即可.camera——相机,相应的accept为image : cam ...

  4. Android 监听软键盘点击回车及换行事件

    mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean ...

  5. PythonAdvanced

    PythonAdvanced function 函数 (要多使用函数,方便,少变量,好改错) 函数是可以重复执行的语句块,可以重复使用 作用: 1.用于封装语句块,提高代码的重用性 2.定义用户级别的 ...

  6. Redis实现Mybatis的二级缓存

    一.Mybatis的缓存 通大多数ORM层框架一样,Mybatis自然也提供了对一级缓存和二级缓存的支持.一下是一级缓存和二级缓存的作用于和定义. 1.一级缓存是SqlSession级别的缓存.在操作 ...

  7. Android OnGestureListener用法 识别用户手势 左右滑动

    Android可以识别用户的手势(即用户用手指滑动的方向),通过用户不同的手势,从而做出不同的处理 需要使用OnGestureListener 比如说看电子书的时候翻页,或者要滑动一些其他内容 直接上 ...

  8. POJ 1201 Intervals || POJ 1716 Integer Intervals 差分约束

    POJ 1201 http://poj.org/problem?id=1201 题目大意: 有一个序列,题目用n个整数组合 [ai,bi,ci]来描述它,[ai,bi,ci]表示在该序列中处于[ai, ...

  9. MM常用的双关语(男士必读)

    我们还是当朋友好了 (其实你还是有多馀的利用价值)我想我真的不适合你(我根本就不喜欢你.)天气好冷喔,手都快结冰了 (快牵我的手吧,大木头!)我觉得我需要更多一点的空间 (我不太想看到你啦!)其实你人 ...

  10. thinkphp中view页面中的volist标签转化为原生php分析(多去看源代码,你会发现不仅简单,方便你理解,还节约时间)

    thinkphp中view页面中的volist标签转化为原生php分析(多去看源代码,你会发现不仅简单,方便你理解,还节约时间) 一.总结 1.标签和原生php之间的关系:标签只是为了方便你使用,标签 ...