Making your development workflows better
Docker allows you to package an application with all of its dependencies into a standardized unit for software development.
Virtual Machine
Docker
Booting 15 Openstack VMs
Container
Base Image (Debian, CentOS, Alpine)
PHP Installed
Composer Installed
Drush added
Extensions installed
Runtime file system (read-write)
FROM ubuntu
MAINTAINER MajuAnsari <majua@mindfiresolutions.com>
RUN apt-get update \
&& apt-get install -y php php5.6-sqlite php5.6-curl php5.6-gd
COPY configs/php-fpm.conf /etc/php/
WORKDIR /app
COPY . /app
CMD ./run.sh
docker build -t my_first_image .
Public repository of docker images
https://quay.io/ - private repos
$ docker run -d -p 81:80 nginx:latest tail -f /var/log/nginx/access.log
Common arguments:
$ docker run -d -p 81:80 nginx:latest tail -f /var/log/nginx/access.log
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 can be linked together by Docker daemon
MySQL
docker run --name db --expose 3306 -d mysql
Redis
docker run --name redis --expose 6379 -d redis
PHP
docker run --name php --expose 9000 -d --link redis:redis --link db:db php
Nginx
docker run --name nginx -p 81:80 -d --link php:php -v ./src:/var/www nginx
A tool for defining and running multi-container applications with Docker
version: '2'
services:
php-fpm:
image: php-fpm
expose:
- "9000"
links:
- redis
- mysql
nginx:
image: nginx
ports:
- "81:80"
links:
- php-fpm
mysql:
image: mysql
expose:
- “3306”
redis:
image: redis
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
&
Email - majua@mindfiresolutions.com
Twitter - @majuansari
Github - majuansari