ITPub博客

首页 > IT职业 > IT生活 > dockerfiler创建nginx镜像

dockerfiler创建nginx镜像

IT生活 作者:blankrabbit 时间:2021-09-09 10:23:33 0 删除 编辑

依赖上一篇~~~~~~~~~~
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

图片描述

Paste_Image.png

图片描述

Paste_Image.png



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


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/212/viewspace-2821435/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 简单易懂区块链
请登录后发表评论 登录
全部评论

注册时间:2020-07-23

  • 博文量
    0
  • 访问量
    647