Making your development workflows better
Open platform for building, shipping and running distributed applications.
OS level virtualization environment for running multiple isolated Linux systems on a single Linux host.
Used LXC, but now runs on libcontainer
Virtual Machine
Docker
sudo apt-get install docker.io
Mac OSX / Windows
Linux
debian
wget -qO- https://get.docker.com/ | sh
ubuntu
Container
Base Image (Debian, CentOS, Alpine)
Apache Installed
PHP Installed
Apache config file added
Application files added
Runtime file system (read-write)
FROM ubuntu
MAINTAINER George Costanza <george@vandalayindustries.com>
RUN apt-get update && apt-get install -y apache2 php
COPY configs/apache.conf /etc/apache/conf
WORKDIR /app
COPY . /app
CMD ./run.sh
docker build -t my_first_image .
Public repository or docker images
https://quay.io/ - private repos
docker run --rm my_first_image
Runs the image inside a new container
Common arguments:
docker images
View all images on your system
docker ps [-a]
View running or all containers
docker rm [tag/hash]
Delete a container
docker rmi [hash]
Delete an image
PHP
MySQL
Nginx
Redis
Containers are linked together by Docker daemon
MySQL
docker run --expose 3306 -d mysql
Redis
docker run --expose 6379 -d redis
PHP
docker run --expose 9000 -d --link /redis:redis --link /mysql:mysql -v /app:/app my_first_image
Nginx
docker run -p 80:80 -d --link /app:app nginx
A tool for defining and running multi-container applications with Docker
curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo pip install -U docker-compose
web:
build: .
expose:
- "9000"
volumes:
- .:/app
links:
- redis
- mysql
redis:
image: redis
mysql:
image: mysql
nginx:
image: nginx
ports:
- 80:80
links:
- web
docker-compose up [-d]
docker-compose ps
View current containers for project
docker-compose stop [app]
Stop any or all running containers
docker-compose rm [app]
Delete a container
docker-compose build [app]
Force a re-build of an image
More resources...