Docker (Legacy)

getting started

docker deals with containers, docker-compose deals with services.





.docker-compose.yml file lists services along with their images, commands and volumes (= mounted directories).

service is used to run command within specified image, service is run by 1+ containers.

for docker-compose commands to work .docker-compose.yml file must be present in current or one of parent directories.



debugging inside container

this is just one way and probably not the most efficient one:

ping another container


Docker creates a network between all containers managed by the same daemon so it’s possible to access other containers by their names.

say, we have 2 services - app and db:

$ docker-compose exec app sh
# ping db
PING db (172.18.XXX.XXX): 56 data bytes
64 bytes from 172.18.XXX.XXX: icmp_seq=0 ttl=64 time=0.359 ms


Cannot connect to the Docker daemon. Is the docker daemon running on this host?


just install Docker app via brew cask.

it’s possible to install all the necessary docker tools (boot2docker, docker, docker-compose, etc.) manually but I didn’t manage to configure them all in reasonable time. so it’s better to install Docker app - it does all the heavy lifting for you.

$ brew cask install docker

don’t forget to run Docker app after installation (otherwise docker command will not be available in terminal).

lookup on no such host

when running docker run hello-world command host to pull hello-world image from is not found.


host lookup fails when using some DNS servers (in particular when using DNS server of my Internet provider) - use Google DNS server instead.