Docker For Ubuntu


Docker is like a virtual Machine which we can setup for development and deployment. consider the different machine configurations for different PHP framework, like pimcore, zend, symphony. We can create a separate docker image each of these then we can share this image with team to work on it and at last we can deploy the same image on server, So we never need to worry about configuration for a project.

At first we need to create a new account on Docker Hub. This is same as a git-hub which will contains all your created image online. we use docker commit and docker push command to push our changes on docker hub. These commands work on delta basis, so every time you push the changes to docker hub it will only upload the new delta to server.There are several commands available for docker checkout here.

Docker also supports tags so for each docker image we can associate it with tag. the default tag is latest. Always remember to commit and push your changes to docker otherwise you may loose your works.

We can also bind socket and config to docker like mysql socket, apache configs so docker machines socket and config’s will associate with the host machine.

we can also bind docker to machine hosts or can run docker machine with specific docker IP. suppose you want to bind port 80 and 443 to host’s 80 and 443 you can pass (this is the scenario for production mode where we have to run only one project). Or for local machine we can run docker via IP or making an IP entry to hosts file. This may be also considers as as replacement of virtual hosts.

To install docker on Ubuntu machine we first need to install docker. This can be done by following commands

sudo apt-get update
wget -qO- | sh

Once the docker is installed in local machine we run this command to login in docker

docker login

this will prompt the username/password once you successfully login you will be able to create new Docker Image.

service docker start

Once we done with the docker installation we should start docker service first