Experience docker's previous work log Summary

Source: Internet
Author: User

N #2014/09/02 install centos 7

Network Configuration

After centos 7 is installed, the network is unavailable. The network configuration of centos 7 is somewhat different from that of centos 6. After the centos 7 virtual machine is installed, there is a random Nic.ens35. The static IP address is not configured successfully. The default DHCP mode is used to enable the network. You only need to set the NIC configuration file./etc/sysconfig/network-scripts/ifcfg-xxxInONBOOT=yesThe default value is no.
Configure DNS later, as in section 6.

Install docker

In centos 7, it is very easy to install docker. You only need to executesudo yum install dockerYou can.

Run docker

After installing docker, start the docker service.
sudo service docker start

Set automatic start upon startup
sudo chkconfig docker on

Download centos Image
sudo docker pull centos

Then you can start the docker container and execute the command in it.
sudo docker run -i -t centos /bin/bash

Experience docker's knowledge of docker resource isolation features

Docker uses Linux cgroup to isolate resources and restrict resources (CPU, memory, disk, and network) of processes in the container, use namespace to divide processes in the same container into the same group. Docker encapsulates these Linux core technologies to simplify their use.

Start a web application with docker

According to the tutorials provided on the official docker website, it is very simple and fast to start a web application through docker.
sudo docker run -d -P training/webapp python app.py

Of course, you need to download the image before the first operation.

Prepare to demonstrate the docker demonstration target
  1. Use docker to quickly start multiple application instances on a host
  2. Restrict docker CPU and memory usage
  3. Mutual Communication Between docker
Restrict docker CPU and memory usage

After starting a docker container, we can view the IP address of the container.
sudo docker inspect -f ‘{{ .NetworkSettings.IPAddress }}‘ container_name

After the-M parameter is set, top cannot display the memory size of the restricted container.

Compile sample programs

The objective is to write two sample programs. One is device, and a rest interface is provided. Input a device ID and the device name with this ID is returned. The other is the conference module, which calls the device module. Use spring boot. For some time, I did not use spring boot to write programs, which is somewhat unfamiliar. Record the pitfalls encountered when writing these two simple sample programs that are no longer simple.

Gradle buildscript

When you need to introduce a third-party class library in your build process, you need to use the following code:

buildscript {    ext {        springBootVersion = ‘1.1.5.RELEASE‘    }    dependencies {        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")    }}
Command for creating a jar package

Usegradle buildInsteadgradle jar

Preliminary demonstration of docker on

It demonstrates how to encapsulate a Java Web application using a docker container and quickly start multiple containers on a host OS. Further demonstration goals:

  1. Shared directories between containers
  2. Data Persistence
  3. Learn more about cgroups
  4. Memory resource limit: limits the container memory size and starts a Java Process larger than the memory.
Directory sharing between containers and hosts

The Research on this feature took a long time, and later found that the docker version in the epel repository of centos is only 0.11, while the latest version is 1.2.0. After changing the latest docker of the new binary, the directory sharing between containers and between hosts is successful.

Command:docker run -i -t -v /host_dir:/container_dir centos /bin/bash

After the directory sharing between containers and hosts is realized, data persistence is also realized naturally. Operations performed on the shared directory in the container are naturally reflected in the directory corresponding to the host. After the container is stopped or destroyed, the files in this directory still exist.

The management of container clusters is a problem. Although the scale of Polycom product clusters cannot reach the size of Internet companies, the arrival of the cloud era is considered. It is foreseeable to provide customers with Saas-based conference services. In this case, docker container cluster management is a technology that needs to be considered. In this regard, existing technologies include Google's open-source kubernetes and Apache's mesos.

Experience docker's previous work log Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.