docker +nginx +node + vue + postgresql
0. 写在前面nginx + vue + node + postgresql两个镜像ccr.ccs.tencentyun.com/node_test/vue_test # vue + nginxccr.ccs.tencentyun.com/node_test/express_test # express + postgresqlhttps://github.com/liuzemei/docker-
·
0. 写在前面
nginx + vue + node + postgresql
两个镜像
ccr.ccs.tencentyun.com/node_test/vue_test_3 # vue + nginx
ccr.ccs.tencentyun.com/node_test/vue_express_3 # express + postgresql
https://github.com/liuzemei/docker-node-postgres-vue-nginx
1. 安装 docker
1. 安装
yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce --nobest
systemctl start docker
systemctl enable docker
2. 换源
- (阿里云容器镜像服务)[https://cr.console.aliyun.com/]
- (腾讯云镜像服务)[https://cloud.tencent.com/document/product/1207/45596]
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
],
"insecure-registries" : [
"https://ccr.ccs.tencentyun.com"
]
}
```shell
systemctl restart docker
2. 安装 docker-compose
yum install -y epel-release
yum install -y python3-pip
pip3 install docker-compose
docker-compose --version
docker-compose 文件编写
version: '3'
services:
postgres:
image: postgres:latest
restart: always
environment:
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- /home/postgres/data:/var/lib/postgresql/data/pgdata
backend:
image: ccr.ccs.tencentyun.com/node_test/vue_express_3
restart: always
depends_on:
- postgres
proxy:
image: ccr.ccs.tencentyun.com/node_test/vue_test_3
restart: always
ports:
- 80:80
depends_on:
- backend
volumes:
- /home/nginx/logs:/var/log/nginx
3. 运行容器
docker-compose up -d
4. 结束
可以直接去访问自己的端口了。已经部署好了nginx代理前后端,后端连接了postgres数据库。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献2条内容
所有评论(0)