Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Docker in CentOS system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to install Docker in CentOS system". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. Because selinux and LXC conflict, they need to be disabled

The code is as follows:

# vi /etc/selinux/config

SELINUX=disabled

2. Configure Fedora EPEL source

The code is as follows:

# yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

3. Configure hop5.in source

The code is as follows:

# cd /etc/yum.repos.d

# wget http://www.hop5.in/yum/el6/hop5.repo

# yum install kernel-ml-aufs kernel-ml-aufs-devel (yum install 3.10 kernel with aufs module)

4, Install docker-io

The code is as follows:

# yum install docker-io

6. To run docker correctly, you need to add the cgroup file system to/etc/fstab.

The code is as follows:

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

# mount /sys/fs/cgroup

/sys/fs/cgroup can only be mounted by rebooting (because the currently running kernel does not support cgroup), so the above mounted command can also be omitted, but the system needs to be rebooted.

7. Restart the system and select "3.10.5-3.el6.x86_64" kernel

8. After the system starts, confirm the currently running kernel

The code is as follows:

# uname -r

3.10.5-3.el6.x86_64

# grep aufs /proc/filesystems

nodev aufs

Run docker.io in daemon mode (in a new terminal)

The code is as follows:

# docker -d

10. Reset docker's operating environment to solve the above problem.

The code is as follows:

# pkill docker

# iptables -t nat -F

# ifconfig docker0 down

# brctl delbr docker0

# docker -d

With the new kernel installed, there is a boot time selection problem, which is achieved by modifying the/boot/grub/grub.conf file.

grub.conf file parameter significance

The code is as follows:

default=1 #kernel title started by default, 0 means first

timeout=5 #default wait time

splashimage=(hd0,0)/grub/splash.xpm.gz #Specifies the path to the background image of the menu. xpm format, gzip compression, only 14bits color

hiddenmenu #Hide Menu

title CentOS (2.6.32-358.el6.x86_64) #title name, user-definable

root (hd0,0) #Specifies the root location of the grub

#Specify the location of the kernel file, and also indicate the location of the root (after the system is booted). The mount method ro is very important.

#After loading it starts the init process.

kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg0-root rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 rd_LVM_LV=vg0/swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg0/root KEYBOARDTYPE=pc KEYTABLE=us rhgb crashkernel=auto quiet rhgb quiet

#Useful when root file system is mounted during kernel boot

initrd /initramfs-2.6.32-358.el6.x86_64.img

Common error resolution examples:

Example 1

Yum starts reporting errors:

The code is as follows:

Error: Cannot retrieve metalink for repository: epel. Please ...

The solution is to edit/etc/yum.repos.d/epel.repo and comment out the address of the base recovery and mirror.

#baseurl changed to baseurl

mirrorlist changed to #mirrorlist

Example 2

The code is as follows:

"DNS/Networking Errors inside the docker"

[root@localhost ~]# docker -dns="8.8.8.8" run centos:6.4 yum install hiphop-php

2013/08/21 07:53:05 POST /v1.4/containers/create

2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/start

2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/attach? logs=1&stderr=1&stdout=1&stream=1

Loaded plugins: fastestmirror

Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

Could not retrieve mirrorlist http://mirrorlist.centos.org/? release=6&arch=x86_64&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

The following command can be executed to reset docker's runtime environment to resolve the above issue.

The code is as follows:

pkill docker

iptables -t nat -F

ifconfig docker0 down

brctl delbr docker0

docker -d

"How to install Docker in CentOS system" is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report