本地开发中具有远程IP(54.xxx.xxx.23)的docker容器端口映射

时间:2018-12-25 06:56:59

标签: docker docker-compose docker-swarm

我正在为某些我遇到问题的项目担任DevOps

我有一个docker-compose.yml,它可以与192.168.0.38这样的本地IP正常工作,但是我想使用我的AWS IP(54.xxx.xxx.23)而不是本地主机IP映射它。

version: '3'
services:
  api:
    build: ./api
    image: api
    environment:
      - PYTHONUNBUFFERED=1
    expose:
      - ${scikiqapiport}
    ports:
      - ${scikiqapiport}:${scikiqapiport}
    command: 
       "python3 manage.py makemigrations"
    command: 
       "chmod -R 777 ./scikiq/scikiq/static:rw"
    command: 
       "python3 manage.py migrate" 
    command: "gunicorn --workers=3 --bind=0.0.0.0:${scikiqapiport} wsgi"
    restart: on-failure
    depends_on:
      - base
    volumes:
      - "../compressfile:/home/data/arun/compressfile"
      - "static:/home/data/arun/scikiq/scikiq/static:rw"


  scikiqweb:
    build: ./web
    image: web
    ports:
      - ${scikiqwebport}
    command:
      "gunicorn --workers=3 --bind=0.0.0.0:${scikiqwebport} wsgi"
    restart: on-failure
    depends_on:
      - base

  nginx:
    image: nginx
    ports:
      - ${scikiqwebport}:80
    volumes:
      - ./nginx:/etc/nginx/conf.d
    depends_on:     
      - scikiqweb1

  base:
    build: ./base-image
    image: scikiq_base
volumes:
  compressfile:
  static:

您的帮助将不胜感激。

谢谢

1 个答案:

答案 0 :(得分:0)

将公共IP放在使用本地IP的地方