services: postgres1: image:'postgres:17-alpine' container_name:'postgres1' ports: -'${POSTGRES_PORT}:5432' environment: -TZ=Asia/Shanghai # Note: Password can only be set on first startup. You can delete the volume to set a new password. -'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}' volumes: -'postgres_data:/var/lib/postgresql/data' restart:unless-stopped
volumes: postgres_data: driver:local
Verify
mkdir my-app && cd my-app vim compose.yaml # paste the compose.yaml. Save and exit.
services: nginx1: image:'nginx:stable-alpine' container_name:'nginx1' ports: -'${NGINX_PORT}:${NGINX_PORT}' volumes: # The nginx.conf file mapping is optional. You can just put your domain config to /etc/nginx/conf.d/mydomain.conf -./nginx.conf:/etc/nginx/nginx.conf:ro #- ./conf.d/:/etc/nginx/conf.d/:ro #- ./dist:/usr/share/nginx/html:ro restart:unless-stopped
Verify
mkdir my-app && cd my-app vim compose.yaml # paste the compose.yaml. Save and exit.