The content in this repo were created for the Nodevember 2014 talk "Deploying a Scalable Node.js Application with Docker". This README contains the text on the slides for easy copy/paste. The subfolders contain the Dockerfiles and configuration files for each specific application we're dockerizing. The raw keynotes slides are available in slides.zip. A pdf version is available in slides.pdf.
$ sudo apt-get install linux-image-extra-`uname -r`
$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
$ docker run -i -t ubuntu /bin/bash
$ docker run -i -t ubuntu /bin/bash
$ docker run -i -t ubuntu /bin/bash
# mkdir -p /opt/acme
# echo "Hello!" > /opt/acme/hello.txt
# exit
$ docker run -i -t ubuntu /bin/bash
// Make some changes
$ docker ps
$ docker commit [CONTAINER_ID] hello:1.0
$ docker run -i -t hello:1.0 /bin/bash
$ docker login
$ docker commit [CONTAINER_ID] username/hello:1.0
$ docker push username/hello:1.0
$ docker login
$ docker pull username/hello:1.0
$ docker images
$ docker run -i -t username/hello:1.0 /bin/bash
# cat /opt/acme/hello.txt
FROM ubuntu:14.04
RUN mkdir -p /opt/acme
RUN echo "Hello" > /opt/acme/hello.txt
CMD /bin/bash
$ docker build -t inconceivableduck/hello:1.0 .
$ docker run -i -t inconceivableduck/hello:1.0
The Dockerfiles and config files for each specific app is located in subfolders: /redis, /mongo, /app, and /haproxy.
$ mkdir -p /mnt/data/redis
$ docker run -d -v /mnt/data:/data -p 6379:6379 redis
// Install
$ curl --fail -L -O https://github.com/phusion/baseimage-docker/archive/master.tar.gz && \
tar xzf master.tar.gz && \
sudo ./baseimage-docker-master/install-tools.sh
// Use
$ docker ps
$ docker-bash [CONTAINER_ID]
# supervisorctl
$ mkdir -p /mnt/data/mongo
$ mkdir -p /mnt/logs
$ docker run -d -v /mnt/data:/data -v /mnt/logs:/logs -p 27017:27017 mongo
$ mkdir -p /mnt/logs
$ docker run -d -v /mnt/logs:/logs -p 80:80 app
$ docker run -d -v /mnt/logs:/logs -p 81:80 app
$ docker run -d -v /mnt/logs:/logs -p 82:80 app
$ docker run -d -v /mnt/logs:/logs -p 83:80 app
$ docker run -d -v /mnt/logs:/logs -p 84:80 app
$ docker run -d -v /mnt/logs:/logs -p 80:80 haproxy
Quickly stop, remove, and delete all images:
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q)