WindowsDocker镜像构建之Oracle客户端-创新互联
新版的Windows 2016已经支持原生Docker,现在也将部分服务往Docker上迁移进行测试。
创新互联专注于依兰网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供依兰营销型网站建设,依兰网站制作、依兰网页设计、依兰网站官网定制、微信小程序开发服务,打造依兰网络公司原创品牌,更为您提供依兰网站排名全网营销落地服务。环境中有使用.net 3.5和.net 4.0以及有使用Oracle客户端,因此Web容器就需要安装Oracle客户端
Dockerfile
FROM microsoft/iis # install .NET 3.5 ADD sxs /sxs RUN Dism /online /enable-feature /featurename:NetFX3 /All /Source:C:\sxs /LimitAccess && del /S /Q C:\sxs # install ASP.NET 4.5 RUN dism /online /enable-feature /all /featurename:NetFx4 /featurename:IIS-ApplicationInit /featurename:IIS-ASPNET45 /featurename:IIS-ASPNET /NoRestart # enable windows eventlog RUN powershell.exe -command Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\EventLog-Application Start 1 # set IIS log fields RUN /windows/system32/inetsrv/appcmd.exe set config /section:system.applicationHost/sites /siteDefaults.logFile.logExtFileFlags:"Date, Time, ClientIP, UserName, SiteName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, TimeTaken, ServerPort, UserAgent, Referer, HttpSubStatus" /commit:apphost # install Oracle Client ADD win64_11gR2_client.zip /win64_11gR2_client.zip ADD unzip.exe /unzip.exe RUN /unzip.exe /win64_11gR2_client.zip && del /S /Q win64_11gR2_client.zip ADD client.rsp /client/client.rsp RUN /client/setup.exe -silent -force -noconsole -ignoreSysPrereqs -ignorePrereq -waitforcompletion -responseFile C:\client\client.rsp && del /S /Q client #RUN cacls c:\app /T /E /C /G users:r # deploy webapp #COPY publish /inetpub/wwwroot/html # set entrypoint script ADD SetHostsAndStartMonitoring.cmd \SetHostsAndStartMonitoring.cmd ENTRYPOINT ["C:\\SetHostsAndStartMonitoring.cmd"] # declare volumes VOLUME ["c:/inetpub/logs/LogFiles","C:/inetpub/wwwroot/html"]Dockerfile涉及的文件内容有
sxs #在Windows Server 2016 安装包的\sources\sxs\目录
unzip.exe #Oracle Client客户端安装包的client\install目录下
win64_11gR2_client.zip #自行到官方下载
client.rsp #Oracle客户端安装响应文件
SetHostsAndStartMonitoring.cmd
client.rsp
oracle.install.responseFileVersion=http://www.oracle.com/2007/install/rspfmt_clientinstall_response_schema_v11_2_0 ORACLE_HOSTNAME= UNIX_GROUP_NAME= INVENTORY_LOCATION=C:\Program Files\Oracle\Inventory SELECTED_LANGUAGES=zh_CN,en ORACLE_HOME=C:\app\Administrator\product\11.2.0\client_1 ORACLE_BASE=C:\app\Administrator oracle.install.client.installType=Runtime oracle.install.client.customComponents="oracle.precomp:11.2.0.1.0","oracle.ons:11.2.0.0.0","oracle.oraolap.mgmt:11.2.0.1.0","oracle.rdbms.scheduler:11.2.0.1.0" oracle.install.client.customComponents= oracle.install.client.oramtsPortNumber=49152 oracle.install.client.schedulerAgentHostName= oracle.install.client.schedulerAgentPortNumber=SetHostsAndStartMonitoring.cmd
echo %HOST% >>/Windows/System32/drivers/etc/hosts /windows/system32/inetsrv/appcmd.exe delete site "Default Web Site/" /windows/system32/inetsrv/appcmd.exe add apppool /name:"%site_name%" /managedRuntimeVersion:"v%site_version%.0" /managedPipelineMode:Classic -queueLength:65535 /windows/system32/inetsrv/appcmd.exe add site /name:"%site_name%" /physicalPath:"c:\inetpub\wwwroot\html" -serverAutoStart:true /bindings:http://*:80 /windows/system32/inetsrv/appcmd.exe set site /site.name:"%site_name%" /[path='/'].applicationPool:"%site_name%" c:\ServiceMonitor.exe w3svc文件中涉及到三个环境变量
HOST #因为windows Docker无法通过--add-host指host这里通过这种方法指host
site_name #站点域名
site_version #.net版本
Docker启动示例:
docker run -d -p 80 -e site_name=fengwan.blog.51cto.com -e site_version=4 -e host="192.168.2.2 db.51cto.com" -v c:/webroot/fengwan:c:/inetpub/wwwroot/html -v c:/logs:c:/inetpub/logs/logFiles p_w_picpath_name另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网页名称:WindowsDocker镜像构建之Oracle客户端-创新互联
文章地址:http://myzitong.com/article/dsdeco.html