请注意,创建的 Dockerfile 不得带扩展名。 要在 Windows 中做到这一点,只需使用所选编辑器创建该文件即可,而不是使用“Dockerfile”符号(包括引号)保存。
复制
# Sample Dockerfile
# Indicates that the windowsservercore image will be used as the base image.
FROM microsoft/windowsservercore
# Metadata indicating an image maintainer.
LABEL maintainer="[email protected]"
# Uses dism.exe to install the IIS role.
RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart
# Creates an HTML file and adds content to this file.
RUN echo "Hello World - Dockerfile" > c:\inetpub\wwwroot\index.html
# Sets a command or process that will run each time a container is run from the new image.
CMD [ "cmd" ]
有关 Windows 的 Dockerfile 的其他示例,请参阅 [Dockerfile 用于 Windows 存储库] (https://github.com/Microsoft/Virtualization-Documentation/tree/master/windows-container-samples)。
FROM 指令用于设置在新映像创建过程期间将使用的容器映像。 例如,使用指令 FROM microsoft/windowsservercore 时,所得到的映像派生自 Windows Server Core 基本操作系统映像映像并具有对其的依赖关系。 如果正在进行 Docker 生成过程的系统上不存在指定的映像,Docker 引擎将尝试从公有或私有映像注册表下载该映像。
格式
FROM 指令所采用的格式为:
复制
FROM
示例
复制
FROM microsoft/windowsservercore
有关 FROM 指令的详细信息,请参阅 Docker.com 上的 FROM 参考。
RUN
RUN 指令指定将要运行并捕获到新容器映像中的命令。 这些命令包括安装软件、创建文件和目录,以及创建环境配置等。
格式
RUN 指令所采用的格式为:
复制
# exec form
RUN ["", "", ""]
# shell form
RUN
Exec 与 Shell 窗体之间的区别在于 RUN 指令执行的方式。 使用 exec 窗体时,指定的程序显式运行。
以下示例使用了 exec 窗体。
复制
FROM microsoft/windowsservercore
RUN ["powershell", "New-Item", "c:/test"]
检查生成的映像,所运行的命令是 powershell New-Item c:/test。
复制
docker history doc-exe-method
IMAGE CREATED CREATED BY SIZE COMMENT
b3452b13e472 2 minutes ago powershell New-Item c:/test 30.76 MB
为进行比较,下面的示例运行相同的操作,但使用的是 shell 窗体。
复制
FROM microsoft/windowsservercore
RUN powershell New-Item c:\test
这将导致运行指令 cmd /S /C powershell New-Item c:\test。
复制
docker history doc-shell-method
IMAGE CREATED CREATED BY SIZE COMMENT
062a543374fc 19 seconds ago cmd /S /C powershell New-Item c:\test 30.76 MB
Windows 注意事项
在 Windows 上,使用具有 exec 格式的 RUN 指令时,反斜杠必须进行转义。
复制
RUN ["powershell", "New-Item", "c:\\test"]
当目标程序是 Windows Installer 时,在启动实际(无提示)安装过程之前需要执行一个额外步骤:通过 /x: 标志,提取安装程序。 此外,需要等待此命令退出。 否则,安装过程将在未安装任何内容的情况下提前结束。 有关详细信息,请参阅以下示例。
示例
此示例使用 DISM 在容器映像中安装 IIS。
复制
RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart
C:\> docker build -t iis .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM micrsoft/windowsservercore
---> 6801d964fda5
Step 2 : RUN dism /online /enable-feature /all /featurename:iis-webserver /NoRestart
---> Running in ae8759fb47db
Deployment Image Servicing and Management tool
Version: 10.0.10586.0
Image Version: 10.0.10586.0
Enabling feature(s)
The operation completed successfully.
---> 4cd675d35444
Removing intermediate container ae8759fb47db
Step 3 : RUN echo "Hello World - Dockerfile" > c:\inetpub\wwwroot\index.html
---> Running in 9a26b8bcaa3a
---> e2aafdfbe392
Removing intermediate container 9a26b8bcaa3a
Successfully built e2aafdfbe392
其结果是一个新的容器映像,在此示例中名为“iis”。
复制
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
iis latest e2aafdfbe392 About a minute ago 207.8 MB
windowsservercore latest 6801d964fda5 4 months ago 0 B
进一步阅读和参考
[优化适用于 Windows 的 Dockerfile 和 Docker 版本] (optimize-windows-dockerfile.md)
openjdk上关于hotspot将移除永久带的描述非常详细,http://openjdk.java.net/jeps/122
JEP 122: Remove the Permanent Generation
Author Jon Masamitsu
Organization Oracle
Created 2010/8/15
Updated 2011/
PL/SQL也是一门高级语言,所以流程控制是必须要有的,oracle数据库的pl/sql比sqlserver数据库要难,很多pl/sql中有的sqlserver里面没有
流程控制;
分支语句 if 条件 then 结果 else 结果 end if ;
条件语句 case when 条件 then 结果;
循环语句 loop
/*
*开发子程序
*/
--子程序目是指被命名的PL/SQL块,这种块可以带有参数,可以在不同应用程序中多次调用
--PL/SQL有两种类型的子程序:过程和函数
--开发过程
--建立过程:不带任何参数
CREATE OR REPLACE PROCEDURE out_time
IS
BEGIN
DBMS_OUTPUT.put_line(systimestamp);
E
long 长的
show 给...看,出示
mouth 口,嘴
write 写
use 用,使用
take 拿,带来
hand 手
clever 聪明的
often 经常
wash 洗
slow 慢的
house 房子
water 水
clean 清洁的
supper 晚餐
out 在外
face 脸,