如何为docker中的应用配置倍数ips

时间:2016-11-03 20:34:07

标签: java sockets docker docker-compose

我有一个简单的java applet,它具有在套接字服务器(ServerSocket)和套接字客户端之间进行通信的功能,我试图旋转docker。当我用docker-compose.yml给docker-compose up命令时,无法通过客户端套接字找到服务器。如何通过docker-compose指定每台机器的IP?

version: '2'

services:
  server:
    image: busybox
    networks:
      my_net:
        ipv4_address: 172.16.238.10
  app:
    image: busybox
    networks:
      my_net:
        ipv4_address: 172.16.238.11

networks:
  my_net:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 172.16.238.0/24
        gateway: 172.16.238.1
      - subnet: 2001:3984:3989::/64
        gateway: 2001:3984:3989::1

0 个答案:

没有答案