Vagrant is suited to managing virtual machines, while Docker is suited to managing application environments. To better simulate a real runtime environment, this series of articles uses Docker and Docker Compose to build a development environment of Nginx + uWSGI + Django + MySQL + Redis + Rabbit.
1. Basic Concepts
Docker is an open-source application container engine, written in Go and released under the Apache 2.0 license. Docker lets developers package an application together with its dependencies into a lightweight, portable container, and then publish it to a machine.
Docker Compose is a Docker tool for defining and running complex applications.
2. Installing and Using Docker
2.1 Installation
Install Docker on Linux.
| |
Install Docker Compose on Linux.
| |
2.2 Checking Installation Information
Once installation is complete, you can check whether it succeeded with the following commands.
Check the Docker version.
| |
Check the docker-compose version.
| |
Start the Docker Daemon. The Docker Client needs to send the commands entered at the console to the Daemon for execution.
| |
With the docker info command you can see that this machine is using Docker’s native registry mirror.
| |
2.3 Pulling and Starting Images
Pull the hello-world image.
| |
Start the hello-world image.
| |
Check the local image list.
| |
2.4 Configuring a Mirror Accelerator (Optional)
When using Docker you often need to fetch images from the official source, but for network reasons the pull process is very time-consuming, seriously hurting the Docker experience.
The accelerator provided by DaoDlcoud is used here; through intelligent routing and caching it speeds up access to Docker Hub.
| |
3. References
- http://www.linuxidc.com/Linux/2015-07/119961.htm
- https://yeasy.gitbooks.io/docker_practice/
- https://zh.wikipedia.org/zh-cn/Docker_(%E8%BB%9F%E9%AB%94)
