In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to install Docker under CentOS6.X, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
[X] I. disable selinux
Because of the conflict between Selinux and LXC, it is necessary to disable selinux. Edit / etc/selinux/config and set two key variables.
SELINUX=disabledSELINUXTYPE=targeted [X] II. Install Fedora EPEL source rpm-ivh. / epel-release-6-8.noarch.rpm or # yum install http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm[X] III. Add hop5.repo source cp. / hop5.repo / etc/yum.repos.d or: # cd / etc/yum.repos.d # wget http://www.hop5.in/yum/el6/hop5.repo[X] IV, install Dockeryum install [X] upgrade 3.10 kernel with aufs module (optional) yum install kernel-ml-aufs kernel-ml-aufs-devel
Modify the main configuration file / etc/grub.conf of grub and set default=0 to indicate that the content under the first title is the kernel started by default (usually the newly installed kernel is in the first location).
Restart the system reboot now
Then execute uname-r to see if it is already a 3.10 kernel!
[root@localhost ~] # uname-r
3.10.5-3.el6.x86_64
Execute grep aufs / proc/filesystems to see if the kernel supports aufs!
[root@localhost ~] # grep aufs / proc/filesystems
Nodev aufs
[X] install dockeryum install redhat-lsbyum install iptableschkconfig ip6tables offchkconfig iptables offservice ip6tables stopservice iptables stopyum install device-mapper-libsyum install libcgroup*yum install docker-io
If you report an error: Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
The solution is to edit / etc/yum.repos.d/epel.repo and restore the foundation The address of the image is commented out # baseurlmirrorlist and changed to baseurl#mirrorlist and then execute: yum clean all= Package Arch Version Repository Size=Installing: docker-io x8631 64 1.2.0-3.el6 epel 4.2 MInstalling for dependencies: lua-alt-getopt noarch 0.7.0-1.el6 epel 6. 9 k lua-filesystem x86'64 1.4.2-1.el6 epel 24 k lua-lxc X86'64 1.0.6-1.el6 epel 15k lxc X86161.0.6-1.el6 epel 120k lxc-libs X86'64 1.0.6-1.el6 epel 248 kTransaction Summary====Install 6 Package (s) Downloading Packages: (1 Universe 6) : docker-io-1.2.0-3.el6.x86_64.rpm | 4.2 MB 00:02 (2 / 6): lua-alt-getopt-0.7.0-1.el6.noarch.rpm | 6.9 kB 00:00 ): lua-filesystem-1.4.2-1.el6.x86_64.rpm | 24 kB 00:00 (4lap6): lua -lxc-1.0.6-1.el6.x86_64.rpm | 15 kB 00:00 (5 kB 6): Lxc-1.0.6-1.el6.x86_64.rpm | 120 kB 00:00 (6ax 6) : lxc-libs-1.0.6-1.el6.x86_64.rpm | 248 kB 0000- - -rpm is installed manually:
Execute first
Rpm-- nodeps-ev $(rpm-qa | grep-I 'device-mapper-libs-') rpm-- nodeps-ev $(rpm-qa | grep-I' device-mapper-') rpm-- nodeps-ev $(rpm-qa | grep-I 'device-mapper-event-libs-') rpm-- nodeps-ev $(rpm-qa | grep-I' device-mapper-event-') rpm-ivh. / device-mapper-event-1.02.90-2.el6.x86_64 .rpm. / device-mapper-event-libs-1.02.90-2.el6.x86_64.rpm. / device-mapper-1.02.90-2.el6.x86_64.rpm. / device-mapper-libs-1.02.90-2.el6.x86_64.rpm
Re-execution
Rpm-ivh. / lxc-libs-1.0.6-1.el6.x86_64.rpmrpm-ivh. / lua-alt-getopt-0.7.0-1.el6.noarch.rpmrpm-ivh. / lua-filesystem-1.4.2-1.el6.x86_64.rpmrpm-ivh. / lua-lxc-1.0.6-1.el6.x86_64.rpmrpm-ivh. / lxc-1.0.6-1.el6.x86_64.rpm#6.4 version The following requires rpm-ivh. / libcgroup-0.40.rc1-5.el6.x86_64.rpmrpm-ivh. / docker-io-1.3.2-2.el6.x8664.rpm [X] V, Preliminary verification of docker
Enter docker-h and if you have the following output, it proves that docker has been formally installed successfully.
# docker-h Usage of docker:-D=false: Enable debug mode-H = []: Multiple tcp://host:port or unix://path/to/socket to bind in daemon mode, single connection otherwise-api-enable-cors=false: Enable CORS headers in the remote API-b = "": Attach containers to a pre-existing network bridge Use 'none' to disable container networking-bip= "": Use this CIDR notation address for the network bridge's IP Not compatible with-b-d=false: Enable daemon mode-dns= []: Force docker to use specific DNS servers-g = "/ var/lib/docker": Path to use as the root of the docker runtime-icc=true: Enable inter-container communication-ip= "0.0.0.0": Default IP address to use when binding container ports-iptables=true: Disable docker's addition of iptables rules-p = "/ var/run/docker.pid": Path to use for daemon PID file-r=true: Restart previously running containers -s = "": Force the docker runtime to use a specific storage driver-v=false: Print version information and quit [X] VI. Start the docker service: service docker start#docker-d-H unix:///var/run/docker.sock [X] VII. Find the image:
The name of the docker search image searches for the desired image from index.docker.io. Go to https://index.docker.io to get image-related information.
[X] 8. Enter the Docker container:
Create vi / bin/docker-enter.sh
#! / bin/shif [- e $(dirname "$0") / nsenter]; then # with boot2docker, nsenter is not in the PATH but it is in the same folder NSENTER=$ (dirname "$0") / nsenterelse NSENTER=nsenterfiif [- z "$1"]; then echo "Usage: `basename" $0 "`CONTAINER [COMMAND [ARG].]" Echo "" echo "Enters the Docker CONTAINER and executes the specified COMMAND." Echo "If COMMAND is not specified, runs an interactive shell in CONTAINER." else PID=$ (docker inspect-- format "{{.State.Pid}" $1 ") if [- z" $PID "]; then exit 1 fi shift OPTS="-- target $PID-- mount-- uts-- ipc-- net-- pid-- "if [- z" $1 "]; then # No command given. # Use su to clear all host environment variables except for TERM, # initialize the environment variables HOME, SHELL, USER, LOGNAME, PATH, # and start a login shell. "$NSENTER" $OPTS su-root else # Use env to clear all host environment variables. "$NSENTER" $OPTS env-ignore-environment-"$@" fifi
Add the executable chmod + x / bin/docker-enter.sh to run docker-enter.sh, which goes to the specified container!
[X] Appendix: earlier versions of Redhat (6.3) may have to mount cgroup manually
We prefer to disable the cgroup corresponding service cgconfig.
Service cgconfig stop # shutdown service chkconfig cgconfig off # cancel boot
Then mount cgroup, which can be mounted on the command line
Mount-t cgroup none / cgroup # is valid only this time
Or modify the configuration file, edit / etc/fstab, and join
None / cgroup cgroup defaults 0 0 and above are all the contents of this article "how to install Docker under CentOS6.X". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.