For the sake of simplicity of deployment it's also good to have docker-compose handy which let's us define a full stack in one file definition. Here is a link to docker-compose repository page: docker-composer project page
docker-compose -v
docker-compose version 1.8.1, build 878cff1
Now docker-engine and docker-compose is installed and ready to use.
INTRO docker-compose
This is short intro of what is docker-compose and how to use it.
Having docker engine installed we are capable of wrapping any app as a container. By doing this we are platform independet and we can take advantage of continuous integration. In baby steps:
Create repository for your app in bitbucket or github
Put your app into repository
Create Dockerfile which will describe the process of creating docker container
Set up hub.docker.com account and create Automated build repository and connect it to your bitbucket/github account
Push your app to repository [at this step via webhooks hub.docker.com will get notified there is a change in a repository will download your code and docker file and build your container]
When the process of building the container will finish your container is ready to use
At this stage we can of course use docker run or docker pull and make use of the container but it's very rare that your app doesn't repend on any additional software
At this point we use docker-compose
docker-compose is using yml files to describe the whole stack where your application lives and for example instead of executing each container manually, linking it manually and starting it manually we can simply describe it in docker-compose format and launch it.
Let's say our stack consist of nginx and redis and we would like to describe it in docker-compose format:
After you have docker-compose.yml in testdir simply start the whole stack by typing:
docker-compose up
This command will download nginx and redis-server container, run both containers, bind nginx container on port 80 and expose redis-server to nginx container so nginx can access redis-server.
Setting up docker on ubuntu 16.04
HOST SECTION
Installation of required packages, adding repository keys, updating repositiory and packages list
In order to be able to use aufs
Installing docker engine
Checking if docker has been installed properly
For the sake of simplicity of deployment it's also good to have docker-compose handy which let's us define a full stack in one file definition. Here is a link to docker-compose repository page: docker-composer project page
Installing docker-compose
and checking if everything went well
Now docker-engine and docker-compose is installed and ready to use.
INTRO docker-compose
This is short intro of what is docker-compose and how to use it. Having docker engine installed we are capable of wrapping any app as a container. By doing this we are platform independet and we can take advantage of continuous integration. In baby steps:
docker-compose is using yml files to describe the whole stack where your application lives and for example instead of executing each container manually, linking it manually and starting it manually we can simply describe it in docker-compose format and launch it. Let's say our stack consist of nginx and redis and we would like to describe it in docker-compose format:
Create test directory
Create in our test dir docker-compose.yml
docker-compose.yml
After you have docker-compose.yml in testdir simply start the whole stack by typing:
This command will download nginx and redis-server container, run both containers, bind nginx container on port 80 and expose redis-server to nginx container so nginx can access redis-server.
To stop our stack we simply type: