安装
Mac推荐手动下载,brew太慢了太慢了!
centos安装
常用命令
docker pull
docker images
docker ps -a
docker run —name nginx -p 8080:80 -d nginx
docker exec -it nginx /bin/bash
exit
将主机/www/runoob目录拷贝到容器96f7f14e99ab的/www目录下。
docker cp /www/runoob 96f7f14e99ab:/www/
将主机/www/runoob目录拷贝到容器96f7f14e99ab中,目录重命名为www。
docker cp /www/runoob 96f7f14e99ab:/www
/etc/nginx/conf.d
/usr/share/nginx/html
打包发布
server {listen 80;listen [::]:80;server_name localhost;#charset koi8-r;#access_log /var/log/nginx/host.access.log main;#location /qingdao {# proxy_pass: http://dtp-demo-web-qindao:8991/;#}location / {root /usr/share/nginx/html;index index.html index.htm;try_files $uri $uri/ /index.html;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}location /api/ {proxy_pass http://dt-co-server.hdt.cosmoplat.com;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}}
FROM nginxCOPY dist /usr/share/nginx/htmlCOPY default.conf /etc/nginx/conf.d/default.confEXPOSE 80
echo "获取最新代码"git pullecho "打包"npm run buildecho "替换dist"rm -rf docker/distcp -r dist docker/dist# 发布cd dockerecho "docker打包镜像"docker build -t registry2-qingdao.cosmoplat.com/skcc/dt-co-web:$1 .docker imagesecho "docker登录"# docker login -u <用户ID> -p <access_key> registry2-qingdao.cosmoplat.comecho "docker推送"docker push registry2-qingdao.cosmoplat.com/skcc/dt-co-web:$1
