A step by step tutorial about installing and using Docker for your Development(Dev) Environment. After the end of this tutorial, you should be able to use Docker for your day-day development work.
The almost same tutorial is available in text format on my blog. Visit: http://bit.ly/2Gijqgk
These slides were discussed in a youtube video here:- http://bit.ly/2Gr2Qeb
2. What is Docker?
From Wikipedia:
Docker is a computer program that performs
operating-system-level virtualization, also
known as “containerization”.[6] It was first
released in 2013 and is developed by
Docker, Inc.[7]
5. What Docker did?
• Light-weight containers.
• Allowed developers to use latest softwares
efficiently even if they were not compatible
with their machines.
• Mimic a scalable scenario on a developer by
running multiple containers for a server.
• Deployable. No more “It runs on my machine”
excuse.
8. Architecture(Contd..)
Images
• A template consists of instructions how a
container should be created.
• Think of it a recipe that consists of instructions
that how to use ingredients to make a dish.
• Every image is based on a base image which
usually belongs to an operating system(e.g.
Java image is based on Ubuntu OS image).
• Dockerfile is used to put all instructions for
image creation.
9. Architecture(Contd..)
Containers
• Containers are an abstraction at the app layer
that packages code and dependencies together.
• Running instance of the image.
• Think of it as a dish prepared with the help of a
recipe. So whatever you put in your Dockerfile,
you see the output of it in your container.
• The idea of containers taken from shipping
containers
11. Architecture(Contd..)
• Repositories which store images.
• Docker Hub as a public
registry(https://hub.docker.com/).
• Docker commands run, pull and, build are
used to acquire and use images.
12. Installation
• Available for Linux, OSX and Windows.
• Certain requirements for using Docker for
Windows on Windows OS like Hyper-V
enabled and Windows 10 Pro installed. More
from here(https://docs.docker.com/docker-
for-windows/install/#start-docker-for-
windows).
• OSX (https://docs.docker.com/docker-for-
mac/install/)
15. Building image
• docker build -t tut:php_img .
• In name:tag format where tut is the name and
php_img is the tag.
16. Running image
• docker run -p 8000:80
tut:php_img
• In name:tag format where tut is the name and
php_img is the tag.
• docker run -p 8000:80 -v
/path/to/src:/var/www/html/ tut:php_img