美文网首页Docker
dockerfiler创建nginx镜像

dockerfiler创建nginx镜像

作者: 如来自然 | 来源:发表于2016-03-07 14:03 被阅读649次

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

相关文章

网友评论

    本文标题:dockerfiler创建nginx镜像

    本文链接:https://www.haomeiwen.com/subject/cenakttx.html