原因:AgentHub须要每一个Agent打包一个前端页面的docker镜像css
采起的是用nginx做为服务器,环境是centos7html
yum -y install docker
前端
systemctl start docker
nginx
我是放在/home/jarjune/
目录下,web
其中,docker
/conf
是放nginx配置文件Dockerfile
是制做镜像的文件/images
是存放最后生成的镜像resource
是存放前端页面#user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; server { #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } listen 7777; server_name test.com; location ~ .*\.(css|js|swf|html|htm|pdf)$ { add_header Cache-Control no-store; #add_header Content-Security-Policy upgrade-insecure-requests; root /var/www/html; autoindex on; index index.html index.htm; } location / { charset utf-8; root /var/www/html; index index.html index.htm index.shtml; } } }
# Base images 基础镜像 FROM nginx:latest #MAINTAINER 维护者信息 MAINTAINER robot robot@yunqiacademy.org ENV RUN_USER nginx ENV RUN_GROUP nginx ENV DATA_DIR /var/www/html #ADD #RUN 执行如下命令 RUN mkdir -p /var/www/html #COPY COPY ./resource/ /var/www/html COPY ./conf/nginx.conf /etc/nginx #EXPOSE 映射端口 EXPOSE 7777 #CMD 运行如下命令 CMD ["nginx", "-g", "daemon off;"]
docker build --rm --tag nginx_webapp:1.0.0 .
centos
docker images
浏览器
docker run -d -p 81:7777 -it nginx_webapp:1.0.0 /bin/bash
bash
docker ps
服务器
docker attach 81ad9dbc2a7a
nginx
浏览器输入地址
docker save -o images/nginx_webapp_1.0.0.tar nginx_webapp:1.0.0