Skip to content

Instantly share code, notes, and snippets.

@Shawyeok
Created March 22, 2017 18:22
Show Gist options
  • Save Shawyeok/90737876ecef7aa47b598a7854a8a674 to your computer and use it in GitHub Desktop.
Save Shawyeok/90737876ecef7aa47b598a7854a8a674 to your computer and use it in GitHub Desktop.
Test docker compose network, only link without ports/expose.
version: '2.0'
services:
client:
image: busybox
command: [sh, -c, 'echo ping | nc server 1234']
links:
- server
server:
image: busybox
command: [nc, -l, -p, '1234']
@Shawyeok
Copy link
Author

The command output:

$ docker-compose up
Creating network "busybox_default" with the default driver
Creating busybox_server_1
Creating busybox_client_1
Attaching to busybox_server_1, busybox_client_1
server_1  | hello world
busybox_server_1 exited with code 0
busybox_client_1 exited with code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment