继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

dockerfiler创建nginx镜像

三国纷争
关注TA
已关注
手记 473
粉丝 51
获赞 178

依赖上一篇~~~~~~~~~~
Dockerfile:

[root@localhost nginx_dockerfile]# cat Dockerfile
FROM sshd:dockerfile
RUN apt-get install -y nginx && rm -rf /var/lib/apt/lists/* &&
echo "\ndaemon off;" >> /etc/nginx/nginx.conf &&
chown -R www-data:www-data /var/lib/nginx

RUN echo "Asia/Shanghai" >/etc/timezone && dpkg-reconfigure -f noninteractive tzdata

ADD run.sh /run.sh
RUN chmod 755 /*.sh

VOLUME ["/etc/nginx/sites-enabled","/etc/nginx/certs","/etc/nginx/conf.d","/var/log/nginx"]

WORKDIR /etc/nginx

CMD ["/run.sh"]

EXPOSE 80
EXPOSE 443

run.sh
[root@localhost nginx_dockerfile]# cat run.sh

!/bin/bash

/usr/sbin/sshd &
/usr/sbin/nginx

[root@localhost nginx_dockerfile]# docker build -t nginx:stable .

[root@localhost nginx_dockerfile]# docker run -d -P nginx:stable

webp

Paste_Image.png

webp

Paste_Image.png



作者:付炜超
链接:https://www.jianshu.com/p/bb4762bb6fe7


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP