Centos6.5 Install/Run/boot/login Docker

Source: Internet
Author: User
Tags lua centos docker run
Pre-conditional Linux system 64-bit system supports storage drivers such as AUFS or devicemapper (we use AUFS here) to upgrade the kernel

Check to see if support for the aufs,centos6.5 and RHEL6.5 2.6 kernels does not support AUFS, so you need to upgrade to 3.1 of the AUFS already supported, and if you are using CENTOS7, you have supported this feature check if you support Aufs

[Root@entel1/]# grep aufs/proc/filesystems
nodev   aufs
Check kernel version

Use Uname–r or view/etc/grub.conf

Find: Title CentOS (3.10.5-3.el6.x86_64)

Require cores above 3.8 and 3.8+

[Root@entel1/]# uname-r 3.10.5-3.el6.x86_64 [Root@entel1/]# [Root@entel1/]# cat/etc/grub.conf # grub.conf generated By Anaconda # # of you don't have to rerun grub on making changes to this file # Notice:you have a/boot part  Ition.
This means so # all kernel and INITRD paths are relative to/boot/, eg. # root (hd0,1) # kernel/vmlinuz-version ro Root=/dev/mapper/vg00-lvroot # Initrd/initrd-[gene
Ric-]version.img #boot =/dev/sda1 Device (hd0) HD (1,800,400000,38768c38-56a9-494e-8527-5f410e905353) default=0  Timeout=5 splashimage= (hd0,1)/grub/splash.xpm.gz hiddenmenu title CentOS (3.10.5-3.el6.x86_64) root (hd0,1) kernel /vmlinuz-3.10.5-3.el6.x86_64 ro root=/dev/mapper/vg00-lvroot rd_no_luks lang=en_us. UTF-8 rd_lvm_lv=vg00/lvroot rd_no_md Sysfont=latarcyrheb-sun16 rd_lvm_lv=vg00/lvswap Crashkernel=128M PC Keytable=us rd_no_dm rhgb quiet initrd/initramfs-3.10.5-3.el6.x86_64.img title CentOS (2.6.32-431.el6.x86_64) root (hd0,1) kernel/vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg00-lvroot rd_no_luks LANG=en_US. UTF-8 rd_lvm_lv=vg00/lvroot rd_no_md Sysfont=latarcyrheb-sun16 rd_lvm_lv=vg00/lvswap Crashkernel=128M  PC Keytable=us RD_NO_DM rhgb quiet initrd/initramfs-2.6.32-431.el6.x86_64.img [Root@entel1/]#
Upgrade kernel

If not supported, upgrade your kernel

Address: http://down.51cto.com/data/1903250

Or:

http://www.hop5.in/yum/el6/kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm

http://www.hop5.in/yum/el6/kernel-ml-aufs-devel-3.10.5-3.el6.x86_64.rpm

Includes: kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm.gz kernel-ml-aufs-devel-3.10.5-3.el6.x86_64.rpm.gz

Installation:

Or

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

Modify GRUB's primary configuration file/etc/grub.conf, set default=0, to indicate that the content under the first title is the default-initiated kernel (typically the newly installed kernel is in the first position), if not the first location, modify it according to the specific location

Reboot the system when the installation is complete

Reboot

Check kernel and AUFS support after reboot

[Root@entel1/]# uname-r
3.10.5-3.el6.x86_64

OK upgrade Complete installation Docker networking installation

If the Linux host can connect to the Internet, congratulations, this method is very simple 1, first off SELinux:

Setenforce 0
Sed-i '/^selinux=/c\selinux=disabled '/etc/selinux/config
2, in Fedora Epel Source has provided a Docker-io package, download installation Epel:
RPM-IVH http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Sed-i ' s/^mirrorlist=https/mirrorlist=http/'/etc/yum.repos.d/epel.repo

or http://dl.fedoraproject.org/pub/epel/6/x86_64/docker-io-1.7.1-2.el6.x86_64.rpm 3, yum installation Docker-io:

Yum-y Install Docker-io
4, start Docker:
Service Docker start

The first boot also automatically configures Cgconfig 5, viewing the Docker version

[Root@entel1/]# Docker version
client version:1.7.1
client API version:1.19 go
version (Client): go1.4.2
  git commit (client): 786b29d/1.7.1
os/arch (client): linux/amd64
server version:1.7.1
server API version:1.19 Go
version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
os/arch (server): LINUX/AMD64
Local Installation

If the Linux host is not connected to the Internet, the scheme is as follows (many many RPM packages will be installed)
Mine is not connected ... o (╯-╰) o 1, first off SELinux:

Setenforce 0
Sed-i '/^selinux=/c\selinux=disabled '/etc/selinux/config
2. Download the support package that needs to be installed

Address: https://pkgs.org/centos-6/centos-x86_64/

bridge-utils-1.2-10.el6.x86_64.rpm
device-mapper-1.02.117-7.el6.x86_64.rpm
device-mapper-event-1.02.117-7.el6.x86_64.rpm
device-mapper-event-libs-1.02.117-7.el6.x86_64.rpm
device-mapper-libs-1.02.117-7.el6.x86_64.rpm
docker-io-1.7.1-2.el6.x86_64.rpm
iproute-2.6.32-130.el6ost.netns.2.x86_64.rpm
iproute-2.6.32-54.el6.x86_64.rpm
iproute-devel-2.6.32-54.el6.x86_64.rpm
iproute-doc-2.6.32-54.el6.x86_64.rpm
kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm
kernel-ml-aufs-devel-3.10.5-3.el6.x86_64.rpm
libcgroup-0.40.rc1-17.el6_7.x86_64.rpm
lua-alt-getopt-0.7.0-1.el6.noarch.rpm
lua-filesystem-1.4.2-1.el6.x86_64.rpm lua-lxc-1.0.8-1.el6.x86_64.rpm
lxc-1.0.8-1.el6.x86_64.rpm lxc-libs-1.0.8-1.el6.x86_64.rpm
xz-4.999.9-0.5.beta.20091007git.el6.x86_64.rpm
xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm
xz-libs-4.999.9-0.5.beta.20091007git.el6.x86_64.rpm
xz-lzma-compat-4.999.9-0.5.beta.20091007git.el6.x86_64.rpm

Pack together with the same functionality:
For example, install LXC:

RPM–UVH lxc-libs-1.0.8-1.el6.x86_64.rpm  lxc-1.0.8-1.el6.x86_64.rpm

This avoids the problem of package dependencies, other packages are similar, please treasure ... 3, start Docker:

Service Docker start
4, view Docker version
[Root@entel1/]# Docker version
client version:1.7.1
client API version:1.19 go
version (Client): go1.4.2
  git commit (client): 786b29d/1.7.1
os/arch (client): linux/amd64
server version:1.7.1
server API version:1.19 Go
version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
os/arch (server): linux/ Amd64
Creating a container
Docker run-it--ipc=host-h=xiaogongjiang--name Xiaogongjiang--net=none Sshd–d

Description: Ipc=host: The internal container needs to use the host's memory configuration parameters, such as Tt,qmdb H=xiaogongjiang: Set the host's hostname name Xiaogongjiang: Set the container name to XIAOGONGJIANG/USR /sbin/sshd: Start the SSH service Net=none do not set the container IP other parameters through the Docker run–help view the description of the new network Bridge

The early 4 network models of Docker:

Bridge Mode: default mode, assigning namespace, NIC, IP, etc. to the container, and connecting to the host virtual Bridges (DOCKER0)

Host mode: Using host namespace, IP, and port

Container mode: Use namespace, IP, and ports that already exist in the container

None Mode: Container has its own namespace, need to add additional network card, configure IP, etc.

Because there is no IP allocated by the container itself. So we need to add a new network bridge

See additional Network Bridge BRIDGE0 for host hosts and configure Iptables to allocate IP

The way to create a container is to use a method that does not assign IP (net=none), where the script manually configures an IP

See the call script to manually assign an IP connection container

If you use the Docker attach command to enter the container, exiting will cause the container to also shut down, and there can be only one user action when multiple users log on
Use this here instead. SSH service started when creating a container
If the service stops, start by using the following command:

Docker exec-it Countainer_id/usr/sbin/sshd–d

Note Replace the corresponding countainer_id

SSH Login:

[Root@entel1 ~]# ssh 172.25.243.103
root@172.25.243.103 ' password: Last 
login:tue Oct one 03:15:07 2016 from 10.4 5.40.231
root@/root>

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.