Horje
How to link multiple docker-compose services via network Code Example
How to link multiple docker-compose services via network
How to link multiple docker-compose services via network

$ docker network create external-example
2af4d92c2054e9deb86edaea8bb55ecb74f84a62aec7614c9f09fee386f248a6


Modified first docker-compose file with network configured
version: '3' 
services: 
  service1: 
    image: busybox 
    command: sleep infinity 

networks: 
  default: 
    external: 
      name: external-example 
      
Modified second docker-compose file with network configured
version: '3' 
services: 
  service2: 
    image: busybox 
    command: sleep infinity 

networks: 
  default: 
    external: 
      name: external-example
      
With the containers using the external-example network, they are able to ping one another.


# By service name
$ docker exec -it compose1_service1_1 ping service2
PING service2 (172.24.0.3): 56 data bytes
64 bytes from 172.24.0.3: seq=0 ttl=64 time=0.054 ms
^C
Source: tjtelan.com




Whatever

Related
destructive db action rails Code Example destructive db action rails Code Example
mysqli auto increment id Code Example mysqli auto increment id Code Example
height form the top to the element Code Example height form the top to the element Code Example
42 mib to bits Code Example 42 mib to bits Code Example
Tagging with multi-value select boxes Code Example Tagging with multi-value select boxes Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7