简单说明一个docker镜像的做成
Docker 文件
#使用的基础镜像
FROM httpd:latest
#作者信息描述
MAINTAINER Alex AlexDu@qnjslm.com
#执行的操作,把游戏拷贝到容器目录中
COPY game /usr/local/apache2/htdocs/
暴露在外面的端口
EXPOSE 80
启动执行的命令
CMD ["httpd-foreground"]
执行docker的build方式,我这是在windos上操作。
首现切换到我们目录下面,game里面是放的网页文件
PS F:\Alex\2048> docker build -t ganyazhi .
Sending build context to Docker daemon 7.354MB
Step 1/5 : FROM httpd:latest
---> 74ad7f48867f
Step 2/5 : MAINTAINER Alex AlexDu@qnjslm.com
---> Running in f002754053fb
---> 3e756dc4e367
Removing intermediate container f002754053fb
Step 3/5 : COPY game /usr/local/apache2/htdocs/
---> 9bccc20fa586
Step 4/5 : EXPOSE 80
---> Running in 032741bb749a
---> c39502366604
Removing intermediate container 032741bb749a
Step 5/5 : CMD httpd-foreground
---> Running in e7e90a70263a
---> ffeb006ef6bb
Removing intermediate container e7e90a70263a
Successfully built ffeb006ef6bb
Successfully tagged ganyazhi:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double
check and reset permissions for sensitive files and directories.
PS F:\Alex\2048>
完成后我们查看docker的镜像文件,发现了我们的镜像
启动我们的镜像
从浏览器打开验证,就可以完我们的游戏了
本文档的相关资料下载地址
链接:https://pan.baidu.com/s/1qYt86Hu 密码:3fhn
文章末尾固定信息
评论