Docker – Part 4 – Manage data in docker containers

Mount a host directory as data volume

You can mount a directory from host to a container

# Create a directory on the host
[root@dockervn ~]# mkdir -p /var/docker/disk01

# Run a container with mounting /var/docker/disk01 to /mnt
[root@dockervn ~]# docker run -i -t -v /var/docker/disk01:/mnt centos /bin/bash
[root@2985e50c258f /]# df -h
Filesystem Size     Used     Avail     Use%     Mounted on
/dev/mapper/docker-253:0-17174473-8dd986c417c6d     10G     241M     9.8G     3%     /
tmpfs 921M 0     921M 0%     /dev
tmpfs 921M 0     921M 0%     /sys/fs/cgroup
/dev/mapper/centos-root                  14G      1.9G 13G      14%     /mnt
shm 64 M 0 64M      0%     /dev/shm

Read the rest of this entry

Docker – Part 3 – Installation

Add docker repo

sudo tee /etc/yum.repos.d/docker.repo <<-‘EOF’
[dockerrepo] name=Docker Repository
enabled=1 gpgcheck=1 gpgkey=

Read the rest of this entry

Docker – Part 2 – Overview


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

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.
    Read the rest of this entry

Docker – Part 1 – Overview


Docker is an open-source platform that allows you to build, run, test, and deploy your applications inside software containers.

  • Containers are a method of operating system virtualization that allow you to run an application and its dependencies in resource-isolated processes.
  • Containers allow you or developers to easily package up an application’s code, configurations, dependencies and ship it all out as one package. By doing so, we can rest assured that the application will run on any other machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

In short:

  • Docker enables you to deploy your application to a container.
  • Docker is designed to deliver your applications faster.
  • Docker is also considered as a container engine and a container management tool


Read the rest of this entry

MySQL – Part 2 – HA with Heartbeat and replication


Software version: CentOS 6.5 and MySQL 5.6

MySql replication master-slave with heartbeat

Read the rest of this entry