您的位置:首页 > 运维架构 > Docker

openresty之docker 镜像

2017-07-18 00:34 148 查看
基础镜像是按照上编博客-openResty入门-安装编 创建的以ubuntu 为原始镜像,执行 docker run -it ubuntu sh 之后执行一步一步安装,最后 docker commit 保存出来的镜像为基础镜像

➜  openresty git:(master) cat Dockerfile
FROM harbor.enncloud.cn/qinzhao-harbor/ubuntu-openresty:v1.0.0

ENV PATH /usr/local/openresty/nginx/sbin:$PATH

ADD nginx.conf /work/conf/

WORKDIR /work/

EXPOSE 8080

CMD /usr/local/openresty/nginx/sbin/nginx -g 'daemon off;' -c /work/conf/nginx.conf


nginx.conf的内容

➜  openresty git:(master) cat nginx.conf
worker_processes  1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}


执行docker build

docker build -t

reg.enncloud.cn/qinzhao-harbor/ubuntu-openresty:v1.0.14 -f Dockerfile

➜  openresty git:(master) sudo docker ps
Password:
CONTAINER ID        IMAGE                                                     COMMAND                  CREATED             STATUS              PORTS                                                                               NAMES
81aa43d8ec48        reg.enncloud.cn/qinzhao-harbor/ubuntu-openresty:v1.0.14   "/bin/sh -c '/usr/..."   10 hours ago        Up About an hour    0.0.0.0:9900->8080/tcp                                                              eager_euclid


访问localhost:9900

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  openresty