NOTES: The document is outdated and need to be update later. We did not follow the best practice of docker container and use it a VMs. The plan is to clean it up in next iteration.
The host directoy is share
is mounted to /share
directoy in every container.
docker exec dockerdrill_hive_1 /share/hive/load-data.sh
docker exec dockerdrill_hive_1 /hive/bin/hive -e "select * from Integer_table"
docker exec dockerdrill_hive_1 /share/hive/showtables.sh
====
The following should be updated later
There is a Dockerfile under each service folder. For example, under drill
cd drill
docker build -t xiaom/drill .
docker-compose
is your friend.
# docker run --name [container name] -p [port to access:port exposed] -i -t [memcached image name]
# -v, -volume=[] Bind mount a volume (e.g., from the host: -v /host:/container, from docker: -v /container)
# -h, --hostname="" Container host name
# -P, --publish-all=false Publish all exposed ports to the host interfaces
docker run --name zoo1 -h zoo1 -dns 172.17.42.1 -P xiaom/drill
- https://github.com/wsargent/docker-cheat-sheet#exposing-ports
- https://www.digitalocean.com/community/tutorials/docker-explained-how-to-create-docker-containers-running-memcached
In the entrypoint, we use sed/perl update it on the fly
The problem of linking with containers is that if you restart the linked contaienr (say, zookeeper) and the ip address of that container changes. What will happen? Answer, we need to restart that container. This is the most important one.
Simply use current host as the DNS server
# /etc/dnsmasq.conf
listen-address=0.0.0.0
interface=lo
interface=eth0
interface=docker0
resolv-file=/etc/resolv.dnsmasq.conf
conf-dir=/opt/docker/dnsmasq.d # <== Here !
dns
$ container='db'
$ new_ip=$(docker inspect $container | grep IPAddress | cut -f4 -d'"')
$ echo "host-record=$container,$new_ip" > /opt/docker/dnsmasq.d/0host_$container
$ service dnsmasq restart
We use SkyDNS for now and SkyDock is an adapter on top of SkyDNS for this purpose.