CentOS Installation Docker Basics Tutorial

Source: Internet
Author: User
Tags docker hub docker run

Upgrading CentOS

Preparatory work:

1: Install the Development Platform tool

      yum groupinstall "Development tools"

2: Install the dependent components required for kernel upgrade

      yum install ncurses-develqt-develhmaccalc zlib-devel binutils-devel elfutils-libelf-devel

3:因为selinux和LXC有冲突,所以需要禁用

      # vi /etc/selinux/config SELINUX=disabled

4: 配置Fedora EPEL 源 for Yum Docker-io

# yum Install Epel-release.noarch

5: Download upgrade Linux kernel source, you can go to the official Download kernel version ( need to take Aufs module ), build it yourself. The other is to download the RPM package (http://down.51cto.com/data/1903250) with the Aufs module for direct installation ( recommended )

Upgrading the kernel (direct download RPM):

GZIP-DV kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm.gz

RPM-IVH kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm

    

Set the new kernel as the default startup item, the newly installed kernel will be the first bit in the file list, set to 0

Vi/etc/grub.cong

Default=0

Reboot//restart

UNAME-R//detects current kernel version, 3.10.5-3.el6.x86_64, indicates upgrade kernel success

  

Docker Installation Ideas

1: Install Docker

Yum Install Docker-io

2:要想docker正常运行还需要在/etc/fstab里增加cgroup文件系统

    echo "none /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab

    mount /sys/fs/cgroup

    只有重新启动才能挂载/sys/fs/cgroup(因为当前运行的内核不支持cgroup),所以上面挂载的命令也可以不执行,但系统需要重新启动

3: Detects if the Aufs module is loaded

    grep aufs /proc/filesystems

4:以守护模式运行docker.io(在一个新的终端里)

Docker-d

If an exception occurs:dns/networking Errors inside the Docker,重置docker的运行环境,尝试解决问题

    # pkill docker

    # iptables -t nat -F

    # ifconfig docker0 down

    # brctl delbr docker0

    # docker -d

5: Detect if Docker is working properly

Docker run Hello-world//default does not exist for this image, wait for Docker to download automatically Hello-world

A message appears indicating that the Docker installation was successful

    

Hello from Docker.This message shows the your installation appears to be working correctly.To generate the This message,Docker took the following steps:1. The Docker client contacted the Docker daemon.    2. The Docker daemon pulled the "Hello-world" image from the Docker Hub. (Assuming it was notAlready locally available.) 3.The Docker Daemon created a new container from this image which runs the executable that produces the output of you a Re currently reading. 4. The Docker daemon streamed that output to the Docker client,which sent it to your terminal.To try something more ambitious, you canRunAn Ubuntu container with:$ dockerRun-it Ubuntu Bash forMore examples and ideas,visit:http:docs.docker.com/userguide/

Exception error:

1:docker when the error is started

Starting Cgconfig Service:Error:cannot Mount Cpuset to/cgroupuset:device or resource Busy, (Cgcon Fig starts by reading the configuration in/etc/cgconfig.config to create the Cgroups hierarchy, binds the desired file system and associates the subsystem, creates the Cgroups group and sets the subsystem parameters for each group)
Workaround: br>

Service Cgconfig status//check for normal operation

Vi/etc/cgconfig.conf

Mount {
Cpuset =/cgroup/cpuset;
CPU =/CGROUP/CPU;
Cpuacct =/cgroup/cpuacct;
memory =/cgroup/memory; //Comment out this paragraph, namely: #memory =/cgroup/memory;
devices =/cgroup/devices;
Freezer =/cgroup/freezer;
Net_cls =/cgroup/net_cls;
Blkio =/cgroup/blkio;
}

Service Cgconfig start//Restart Start services

2:error response from Daemon:cannot start container {ID}: [8] System ERROR:WRITE/SYS/FS/CGROUP/DOCKER/{ID}2A7CE2F9BC/CG Roup.procs:no space left on device

Processing method (refer to Address: Http://stackoverflow.com/questions/29961584/docker-cgroup-procs-no-space-left-on-device):

A Simple command should does the trick.

        sudo echo 1 > /sys/fs/cgroup/docker/cgroup.clone_children

If It still does not work, run below commands and restart Docker service:

        sudo echo 0 > /sys/fs/cgroup/docker/cpuset.mems        sudo echo 0 > /sys/fs/cgroup/docker/cpuset.cpus

CentOS Installation Docker Basics Tutorial

Related Article

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.