Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

How to define static ip on docker-compose v3

I'm developing a microservice application with spring boot. While I'm devoloping microservice application, I'm using docker compose. I want to define static ip to my service. But when I define static ip, I'm getting an error.

I'm using version: '3.1' (docker-compose.yml). My error is written below. Where am I doing wrong

ERROR: for service-user  user specified IP address is supported only when connecting to networks with user configured subnets
ERROR: Encountered errors while bringing up the project.

My docker-compose.yml is


  service-user:
    container_name: "service-user"
    hostname: "service-user"
    build: ../../service-user/target
    ports:
      - "8809:8809"
    expose:
      - "8809"
    depends_on:
      - service-eureka
    environment:
      - SPRING_PROFILES_ACTIVE=${profile}
    networks:
      backend:
        ipv4_address: 172.16.238.10

 networks:
  backend:
    driver: bridge
    ipam:
      config:
        - subnet: 172.16.238.0/24

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...