自定义centos nginx镜像

常用工具:wget iproute vim tcpdump net-tools tree bind-utils

复制代码
[root@iZbp1alyggcajdzlz0v7lhZ ~]# cat dockerfile 
FROM centos:7
RUN yum install -y proc-devel gcc gcc-c++ zlib zlid-devel make openssl-devel wget iproute vim tcpdump net-tools tree bind-utils
RUN wget http://nginx.org/download/nginx-1.9.7.tar.gz
RUN tar -zxvf nginx-1.9.7.tar.gz
WORKDIR nginx-1.9.7
RUN ./configure --prefix=/usr/local/nginx && make && make install
EXPOSE 80
EXPOSE 443
RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf
COPY run.sh /
RUN chmod 777 /run.sh
CMD ["sh","-c","/run.sh"]
dockerfile
复制代码

 

[root@iZbp1alyggcajdzlz0v7lhZ ~]# cat run.sh
#!/bin/bash
/usr/local/nginx/sbin/nginx
run.sh

 

docker build -f dockerfile -t test_nginx:1.0 . 

docker run -d --name test111 -p 38:80 6e512a37002b

  #vim /usr/local/nginx/html/index.html

 

docker save 镜像ID > xxxx.tar #导出镜像,压入到压缩包中
docker load < xxxx.tar #导入镜像

============================================

https://blog.csdn.net/weixin_53466908/article/details/124443379   Docker 基于centos构建nginx镜像 构建MySQL镜像

 

posted @   雲淡風輕333  阅读(41)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2022-03-04 二、数据类型:变量、常量;整型、浮点型;格式输入输出符;转义字符'\';sizeof;进制与转换;原码反码补码;数值溢出;类型限定符:extern、const、Volatile、register;函数printf、putchar、scanf、getchar
点击右上角即可分享
微信分享提示