As the testing server in the company is constantly changing, it is troublesome to configure the environment on the new server after each change. Then I suddenly thought about what I saw on the internet that Docker could quickly deploy portable containers, so I tried to use Docker to build a test environment for Tomcat and Oracle. Therefore, this article mainly focuses on some basic concepts and common commands of Docker.
The implementation principle of Docker
Originally I would like to introduce the Docker here, but it seems that there is a lot of information on the Internet, it is suggested that Docker is not very familiar with the "principle" of Baidu Encyclopedia _docker entry, so here is no longer elaborated.
Ready to work Linux users
If you are a Linux user, as long as the Linux kernel is larger than 3.8 , then turn off the SELinux components of the system and install Docker directly with your system's package management tools (Apt-get, yum, etc.). For example, in CentOS, you can install Docker with a single click using the yum install Docker-io .
1, disable SELinux because SELinux and LXC (Docker implementation of the way virtualization) conflict, so you need to disable SELinux. Edit/etc/selinux/config, set two key variables. Selinux=disabled
selinuxtype=targeted
Ubuntu/debian using apt-get install Docker-io
Centos/rehl uses the yum install Docker-io
Because Docker does not directly support these two systems, it is not possible to install bocker directly, but we can boot2docker this tool to support our system indirectly. First you need to install a VirtualBox, this is to install boot2docker preparation, point VirtualBox official website download page, enter and select your system corresponding version and install. Go to boot2docker official website, download the corresponding version of the Boot2docker installation package, after installation, in your program list should be able to see the boot2docker icon. Note: If you are a Mac user, although you can also use brew to install Boot2docker, it is still not recommended that you do that because I installed boot2docker with brew, and did not create an icon, You need to start boot2docker using the Boot2docker initialization command. If you have already done so, you can uninstall Boot2docker with brew First, then delete the. Boot2docker directory under the user directory, and then open VirtualBox to delete the BOOT2DOCKER-VM virtual machine (without deleting it). Then you can install the Boot2docker by installing the package. To avoid confusion in the later use, let me first say a boot2docker implementation principle. Boot2docker is creating a Linux virtual machine in your system that has Docker installed and all Docker-related operations are done on this virtual machine. You can use this command to see the virtual machine's IP address. Usually the IP address should be 192.168.59.103.
Echo $DOCKER _host
- To test whether Docker has been successfully installed
Test method is relatively simple, open the Boot2docker program, will open a terminal, enter the following command, get a "Hello from Docker" Beginning of the introductory information, then the installation is no problem.
Docker Run Hello-world
Docker Learning Note (i): Install and configure Docker locally