You can use the link
option with docker run
:
Run the API:
docker run -d --name api api_image
Run the client:
docker run --link api busybox ping api
You should see that api
can be resolved by docker.
That said, going with docker-compose
is still a better option.