Because the current environment is still under CentOS5, but the new library can only be used under CentOS6. Then use Docker to start the full OS, which saves a little resources compared to ESX.
The current environment is that the host machine is ubuntu 16.04, and the containers are centos5 and centos6
First download the relevant bottom package directly from the official
docker pull centos: 5.11
docker pull centos: 6.8
Then install the relevant software directly on the bottom package
yum groupinstall ...
The above direct group installation method is no problem for 5.11, 6.8 is no way to toss. As long as it is installed on 6.8, and then start the container, it will be stuck
Sulogin this process, and then there is no response (in addition, the rc.sysinit process should disappear after running for a while, but it is always there). I checked that this process is for single user login, and as long as there is this process, there is no way to SSH.
Then I installed it in the following package order.
# Install SSH first, install a commit once, install once per line
openssh-server
# The following is from the Base package
abrt-addon-ccpp abrt-addon-kerneloops abrt-addon-python abrt-cli acpid alsa-utils at authconfig b43-fwcutter bc
biosdevname blktrace bridge-utils centos-indexhtml cpuspeed crontabs cryptsetup-luks cyrus-sasl-plain dbus
fprintd-pam hunspell hunspell-en irqbalance ledmon libaio logrotate
lsof lvm2 man man-pages man-pages-overrides microcode_ctl mlocate mtr nano
ntp ntpdate ntsysv openssh-clients pam_passwdqc pciutils pcmciautils pinfo pm-utils
prelink psacct rdate readahead rfkill
rng-tools rsync scl-utils
setserial
setuptool smartmontools sos strace sysstat system-config-firewall-tui system-config-network-tui systemtap-runtime tcpdump tcsh time tmpwatch traceroute unzip vconfig vim-enhanced virt-what wget words xz yum-plugin-security yum-utils zip bind-utils
# The following is the development tool group directly yum groupinstall ...
"Development tools"
# The following are Desktop, "X windows", and additional developments,
GConf2-devel NetworkManager NetworkManager-gnome alsa-lib-devel alsa-plugins-pulseaudio at-spi audit-libs-devel binutils-devel boost-devel bzip2-devel
control-center control-center-extra cyrus-sasl-devel dbus-glib-devel elfutils-devel elfutils-libelf-devel eog evolution-data-server-devel firstboot gdm
gdm-plugin-fingerprint gdm-user-switch-applet glx-utils gnome-applets gnome-desktop-devel gnome-keyring-devel gnome-media gnome-packagekit gnome-panel gnome-power-manager
java-1.6.0-openjdk-devel perl-devel mysql-devel python-devel perl-ExtUtils-MakeMaker sqlite-devel libcurl-devel
libacl-devel libattr-devel libcanberra-devel libcap-ng-devel libcgroup-devel libgnome-devel libnotify-devel librsvg2-devel libsoup-devel pygtk2-devel readline-devel tbb-devel vnc-server nscd pam_ldap vsftpd
xdg-user-dirs-gtk xorg-x11-drivers xorg-x11-server-Xorg xorg-x11-server-utils xorg-x11-utils xorg-x11-xauth xorg-x11-xinit xvattr yelp
polkit-devel gnome-terminal polkit-gnome spice-vdagent vino wacomexpresskeys wdaemon notification-daemon
Finally, the following packages will be stuck in sulogin as long as they are installed.
The official system is not recommended to boot the complete system. After all, Docker is lightweight, which violates his original intention.
The parameter behind the run to guide the complete system is / sbin / init
After installing autofs, I want to start it and find the prompt:
Starting automount: automount: test mount forbidden or incorrect kernel protocol version, kernel protocol version 5.00 or above required.
[FAILED]
After searching, it turned out that the authority was not enough.
Just add --privileged directly to run, such as:
docker run --rm --privileged -p 3000: 22 -v / root / centos6: / root centos6 / d1103: D / sbin / init
After the container is started, the agetty process CPU is found to be 100% on the host machine, and the dog is released again. The solution is as follows
systemctl list-units * getty *
systemctl stop [email protected] #Mainly after this stop, OK
systemctl stop system-getty.slice
systemctl stop getty.target
In addition, the container also needs to fix the IP, and then use the macvlan method to write a small script to start the container and set the IP
#! / bin / bash
# start container and setting container IP address
if [[$ # -ne 3]]
then
echo "./script.sh image_name ip_dev_name container_ip"
echo ""
echo "./script.sh centos5 / new: A enp4s0 192.168.1.6/24"
echo ""
exit
fi
if [[-z "$ docker_pid"]]
then
echo "docker container name not found"
exit
fi
if [[`ip link | awk -vdev = $ 2‘ $ 2 == dev ":" {a = 1} END {print a} ‘` -ne 1]]
then
echo "ip dev name error"
exit
fi
ip link add "$ 2" .d link "$ 2" type macvlan mode bridge
ip link set netns "$ docker_pid" "$ {2} .d"
nsenter -t "$ docker_pid" -n ip link set "$ {2} .d" up
nsenter -t "$ docker_pid" -n ip route del default
nsenter -t "$ docker_pid" -n ip addr add "$ 3" dev "$ {2} .d"
nsenter -t "$ docker_pid" -n ip route add default via `ip r | awk‘ / default / {print $ 3} ‘` dev "$ {2} .d"
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.