Dockerfile创建自有镜像
2024-09-07 16:29:59
- 文件名必须名为Dockerfile,用touch命令新建Dockerfile文件(执行touch Dockerfile),Dockerfile内容:
from ubuntu --基础镜像名字
maintainer afei1759 --作者
run sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list --用国内站点拿ubuntu的安装包
run apt-get update --用apt-get更新ubuntu程序库
run apt-get install -y nginx --给docker镜像安装nginx
copy /usr/local/java/index.html /var/www/html --将本服务器index.html拷贝到新docker镜像的/var/www/html位置
entrypoint ["/usr/sbin/nginx","-g","daemon off;"] --在前台运行nginx,而非以守护进程执行
expose 80 --暴露80端口
- 在Dockerfile文件目录下执行构建命令,并命名该新镜像为 afei1759/hello-nginx:
docker build -t afei1759/hello-nginx
最新文章
- iOS---正确使用NSNotification对象
- struts2+spring+hibernte整合示例
- eclipse开启断言
- nexcel 读取 excel
- AngularJs学习笔记--bootstrap
- Codeforces Good Bye 2015 C. New Year and Domino 前缀和
- 初学者学习javascript语言应注意的那几点
- error signing assembly unknown error
- GridControl控件添加按钮列及在按钮Click事件中得到行数据 zt
- Android Studio Linking an external C++ project 时候 报Invalid file name. Expected: CMakeLists.txt
- 《转》JAVA并发编程:volatile关键字解析
- Servlet的学习笔记
- SpringBoot Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- MYSQL 主从复制,读写分离(8)
- Linux分区知识及企业场景分区76
- ionic打包步骤(安卓)
- linux课外命令
- python_面向对象小试题
- python学习笔记——urllib库中的parse
- thinkphp模板中使用方法