Docker is a platform for building, shipping and running applications. It provides lightweight virtual containers that allow applications to run consistently regardless of environment. Key Docker concepts include images, containers, Docker Engine and tools like Docker Compose and Docker Machine. The document then provides steps for setting up WordPress and Laravel projects using Docker, including using Docker Compose to define services and Docker Machine to provision and manage Docker hosts.
%in Midrand+277-882-255-28 abortion pills for sale in midrand
Introduction To Docker
1. Introduction to Docker
By
Dr. Syed Hassan Amin
VP Technology
Coeus Solutions Gmbh
Email : Hassan.amin77@gmail.com
Linkedin : https://pk.linkedin.com/in/dr-syed-hassan-amin-7994954
1
2. Outline
Key Issues
Introduction to Docker
Docker Versus Vagrant
Docker Concepts(Containers, images, docker enginer, commands)
Setting up Docker Toolbox on Windows
Docker Tools(Docker-Compose, Docker-Machine etc)
Setting Up Wordpress Using Docker
Setting Up Laravel Using Docker
Setting Up an existing Laravel Project Using Docker
2
3. Key Issues Related to Development
Environment Setup
Deployment on new machine is time consuming and sometimes frustrating
Switching from one project to other is complicated for developers
Different projects have different technology stack which are sometimes
incompatible
Vagrant takes too much space, and computing resources
Don’t want to deal with too many VM’s
3
4. Docker Versus Vagrant
Vagrant creates Virtual Machines in minutes while Docker creates Virtual
Containers in seconds.
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker
provides you lightweight Virtual Containers, that share the same kernel and
allow to safely execute independent processes.
Running a virtual Container is much faster than running a full virtual Machine.
4
5. Introduction to Docker
Docker is a platform that allows you to “build, ship, and
run any app, anywhere.”
Docker is an open-source engine that automates the
deployment of any application as a lightweight, portable,
self-sufficient container that will run virtually anywhere.
Based on LXC (Linux Container), easy to use.
It has come a long way in an incredibly short time and is
now considered a standard way of solving one of the
costliest aspects of software: deployment.
5
7. Docker Concepts
An image is a filesystem and parameters to use at
runtime. It doesn’t have state and never changes.
A container is a running instance of an image.
When you run the command($ docker run hello-world),
Docker Engine:
checked to see if you had the hello-world software image
downloaded the image from the Docker Hub (more about the
hub later)
loaded the image into the container and “ran” it
Depending on how it was built, an image might run a
simple, single command and then exit. This is what Hello-
World did.
7
9. Docker Concepts(Cont’d)
Docker Engine provides the core Docker technology that enables images and
containers.
The Docker command has three parts.
9
11. Setting Up Docker Toolbox on Windows
Install Docker
Toolbox(https://www.docker.com/products/docker-
toolbox)
What’s in the Toolbox
Docker Machine for running docker-machine commands
Docker Engine for running the docker commands
Docker Compose for running the docker-compose commands
Kitematic, the Docker GUI
A shell preconfigured for a Docker command-line environment
Oracle VirtualBox
11
12. Getting Started
Verify your installation
$ docker version
Will show you docker version
$ docker run hello-world
Will confirm your docker is working correctly
To try something more ambitious, you can run an Ubuntu
container with:
$ docker run -it ubuntu bash
12
14. Docker Compose
Compose is a tool for defining and running multi-container
Docker applications.
With Compose, you use a Compose file to configure your
application’s services.
Then, using a single command, you create and start all the
services from your configuration.
Compose is great for development, testing, and staging
environments, as well as CI workflows.
14
15. Docker Compose(Cont’d)
Using Compose is basically a three-step process.
Define your app’s environment with a Dockerfile so it can be
reproduced anywhere.
Define the services that make up your app in docker-
compose.yml so they can be run together in an isolated
environment.
Lastly, run docker-compose up and Compose will start and run
your entire app.
15
17. Docker Machine
Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and
manage the hosts with docker-machine commands.
You can use Machine to create Docker hosts on your local Mac or Windows box,
on your company network, in your data center, or on cloud providers like AWS or
Digital Ocean.
Using docker-machine commands, you can start, inspect, stop, and restart a
managed host, upgrade the Docker client and daemon, and configure a Docker
client to talk to your host.
Docker Engine runs natively on Linux systems.
If you have a Linux box as your primary system, and want to run docker
commands, all you need to do is download and install Docker Engine.
However, if you want an efficient way to provision multiple Docker hosts on a
network, in the cloud or even locally, you need Docker Machine.
17
18. Docker Engine and Docker Machine
When people say “Docker” they typically mean Docker Engine, the client-server application
made up of the Docker daemon, a REST API that specifies interfaces for interacting with the
daemon, and a command line interface (CLI) client that talks to the daemon (through the REST
API wrapper).
Docker Engine accepts docker commands from the CLI, such as docker run <image>, docker ps to
list running containers, docker images to list images, and so on.
18
19. Docker Engine and Docker Machine
(Cont’d)
Docker Machine is a tool for provisioning and managing your Dockerized hosts
(hosts with Docker Engine on them).
Typically, you install Docker Machine on your local system.
Docker Machine has its own command line client docker-machine and the
Docker Engine client, docker.
You can use Machine to install Docker Engine on one or more virtual systems.
These virtual systems can be local (as when you use Machine to install and run
Docker Engine in VirtualBox on Mac or Windows) or remote (as when you use
Machine to provision Dockerized hosts on cloud providers).
The Dockerized hosts are sometimes referred to as, managed “machines”.
19
21. Docker Machine Commands
List available machines :-
$ docker-machine ls
Use docker run to download and run busybox with a simple ‘echo’
command.
$ docker run busybox echo hello world
Get the Docker host’s IP address using the docker-machine ip
command:
$ docker-machine ip default
21
22. Docker Machine Commands (Cont’d)
If you are finished using a host for the time being, you can stop it with
docker-machine stop and later start it again with docker-machine
start.
$ docker-machine stop default
$ docker-machine start default
22
23. Build/Re-build Containers
If you do any change to any dockerfile make sure you run this command, for the changes to take
effect:
$ docker-compose build
Optionally you can specify which container to rebuild (instead of rebuilding all the containers):
$ docker-compose build {container-name}
You might use the --no-cache option if you want full rebuilding (docker-compose build --no-
cache {container-name}).
23
24. Docker Wordpress Setup
1. Create an empty project directory. Give it whatever name you like.
2. This project directory will contain a docker-compose.yaml file which
will be complete in itself for a good starter wordpress project.
3. Create a docker-compose.yml file that will start your Wordpress blog
and a separate MySQL instance with a volume mount for data
persistence(https://docs.docker.com/compose/wordpress/)
4. Build the project by running docker-compose up -d from your
project directory:-
$ docker-compose up -d
24
26. LaraDock VS Homestead
LaraDock and Homestead both gives you a complete
virtual development environments
Homestead is a tool that controls Vagrant for you (using
Homestead special commands). And Vagrant manages your Virtual
Machine.
LaraDock is a tool that controls Docker for you (using Docker &
Docker Compose official commands). And Docker manages your
Virtual Containers.
26
27. Dockerizing an Existing Laravel Project
If you already have a Laravel project, clone this repository on
your Laravel root directory :-
$ git clone https://github.com/coeus-
solutions/SmartFeedbackForms.git
Add LaraDock as submodule :-
$ git submodule add https://github.com/LaraDock/laradock.git
Set up .env and docker-compose.yml(database settings, port
etc)
Change to laradock folder :-
$ docker-compose up -d nginx mysql
27