docker-compose 文件参考详解程序员

参考:

IT虾米网

version: '3' 
 
services: 
  db: 
    image: postgres 
    restart: always 
    environment: 
      POSTGRES_PASSWORD: 12345 
    networks: 
      net-django: 
        ipv4_address: 10.127.2.4 
 
  web: 
    build: . 
    ports: 
      - 8000:8000 
    restart: always 
    privileged: true 
    depends_on: 
      - db 
    networks: 
      net-django: 
        ipv4_address: 10.127.2.3 
    command: bash -c "uwsgi --ini /code/heelo/conf/uwsgi.ini" 
 
  nginx: 
    container_name: nginx-container 
    restart: always 
    depends_on: 
      - web 
    links: 
      - "web:web" 
    build: ./nginx 
    # 将nginx监听端口映射到宿主机的8080端口 
    ports: 
      - 8080:80 
    networks: 
      net-django: 
        ipv4_address: 10.127.2.2 
 
networks: 
  net-django: 
    ipam: 
      config: 
        - subnet: 10.127.2.0/24 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/1608.html

(0)
上一篇 2021年7月15日 23:13
下一篇 2021年7月15日 23:13

相关推荐

发表回复

登录后才能评论