Personal Dev server, host for docker and any personal projects
Please see the bootstrap.sh for detailed information about what's installed.
The intention here is to have a single server that can spin up docker containers for any given stack really quickly and easily.
OpenVSwitch allows for creating either a network of containers, or potentially linking multiple servers (local or otherwise) via VPN and running a single network across them.
So in theory, we should be able to use a single dev server as a "command and control" point to either spin up a stack locally, or drive creation of a dev server that can be accessed locally (not sure about this).
Right now, this isn't being done - I've removed OpenVSwitch until I have some time to really play with that.
Note, this is used as a general proving ground for things myself too - it's public so I can refer people to useful bits (Vagrantfile and bootstrap.sh are the most obvious, and maybe the docker/*/(Dockerfile|run.sh) pattern if that's useful).
Oh, "drun.sh" in the docker/ directory provides a short-cut for running any of the docker/*/run.sh scripts
dd if=/dev/zero of=/swapfile bs=1024 count=2048k
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
echo 10 > /proc/sys/vm/swappiness
echo 'vm.swappiness = 10' >> /etc/sysctl.conf
(but, see https://github.com/silarsis/docker-proxy)
iptables -t nat -A PREROUTING -i docker0 -p tcp --dport 80 -j REDIRECT --to-port 3128
RUN apt-get install libfuse2
RUN cd /tmp ; apt-get download fuse
RUN cd /tmp ; dpkg-deb -x fuse_* .
RUN cd /tmp ; dpkg-deb -e fuse_*
RUN cd /tmp ; rm fuse_*.deb
RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
RUN cd /tmp ; dpkg-deb -b . /fuse.deb
RUN cd /tmp ; dpkg -i /fuse.deb
RUN localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || :
RUN dpkg-divert --local --rename --add /sbin/initctl && rm -f /sbin/initctl && ln -s /bin/true /sbin/initctl
RUN adduser --disabled-password --gecos "" silarsis; \
echo "silarsis ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
ENV HOME /home/silarsis
USER silarsis
WORKDIR /home/silarsis
docker ps -a | grep Exit | awk '{ print $1 }' | xargs -r docker rm
docker rmi $(docker images -f "dangling=true" -q)
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <containerid>
if [ ! sed '/\([0-9\.]*\) registry.dev/,${s//'"${IP}"' registry.dev/;b};$q1' /etc/hosts ]; then
echo "${IP} registry.dev" >> /etc/hosts
end
RUN cp /etc/hosts /tmp/hosts
RUN echo "x.x.x.x something" >> /tmp/hosts
RUN mkdir -p -- /lib-override && cp `find / -iname libnss_files.so.2` /lib-override
RUN perl -pi -e 's:/etc/hosts:/tmp/hosts:g' /lib-override/libnss_files.so.2
ENV LD_LIBRARY_PATH /lib-override
docker commit -run='{"Cmd":["/bin/bash"], "User":"root"}' <containerID> <tag>
Find the vmdk (start virtualbox ui, right click on vm and "show in finder"
VBoxManage showhdinfo <filename>
Get the UUID from the error you see from the above command, then:
VBoxManage clonehd --format VDI <uuid> <newfilename.vdi>
VBoxManage modifyhd <newfilename.vdi> --resize 81920
Go into VirtualBox, settings for the vm, storage, remove the existing drive and add the new one.
https://get.docker.io/builds/Darwin/x86_64/docker-$version.tgz