JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

Setup and usage w/ docker under the CentOS 7.1 x64


話說又到了一周一廢文時間了,雖然前兩天南投Relax一下,該發的廢文還是不能少;前陣子一直想找時間Try DockerUsage,剛好今天有空檔,就來操弄看看,原來和Virsh感覺蠻類似的,Container OS的部分比較像從Github下載整包Source的感覺,因此話不多說,直接看下去怎麼玩吧,如下:
1) Check the current environment w/ CentOS 7.1 x64(Included disk free)
#cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
#df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 xfs 28G 5.0G 23G 19% /
devtmpfs devtmpfs 905M 0 905M 0% /dev
tmpfs tmpfs 914M 140K 914M 1% /dev/shm
tmpfs tmpfs 914M 8.9M 905M 1% /run
tmpfs tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 122M 376M 25% /boot
/dev/sr0 iso9660 4.1G 4.1G 0 100% /run/media/root/CentOS 7 x86_64

2) Install the related packages and enable its services
#yum -y install docker
#rpm -qa | grep -i docker
docker-1.6.2-14.el7.centos.x86_64
docker-selinux-1.6.2-14.el7.centos.x86_64
#systemctl enable docker.service
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service'
#systemctl start docker.service

3) Usage about the docker(Example with debian 8)
#docker search debian
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/ubuntu Ubuntu is a Debian-based Linux operating s... 1948 [OK]
docker.io docker.io/debian Debian is a Linux distribution that's comp... 544 [OK]
docker.io docker.io/google/debian 47 [OK]
docker.io docker.io/neurodebian NeuroDebian provides neuroscience research... 9 [OK]
docker.io docker.io/hanswesterbeek/google-debian-oracle-jdk Oracle's JDK installed on top of Google's ... 7 [OK]
docker.io docker.io/jesselang/debian-vagrant Stock Debian Images made Vagrant-friendly ... 4 [OK]
docker.io docker.io/armbuild/debian ARMHF port of debian 3 [OK]
docker.io docker.io/mschuerig/debian-subsonic Subsonic 5.1 on Debian/wheezy. 3 [OK]
docker.io docker.io/eboraas/debian Debian base images, for all currently-avai... 2 [OK]
docker.io docker.io/fike/debian-postgresql PostgreSQL 9.4 until 9.0 version running D... 2 [OK]
docker.io docker.io/kalabox/debian 1 [OK]
docker.io docker.io/maxexcloo/debian Docker base image built on Debian with Sup... 1 [OK]
docker.io docker.io/takeshi81/debian-wheezy-php Debian wheezy based PHP repo. 1 [OK]
docker.io docker.io/tomdavidson/debian Simple Debian service with nice add script... 1 [OK]
docker.io docker.io/webhippie/debian Docker images for debian 1 [OK]
docker.io docker.io/azukiapp/debian Docker image to run Linux Debian (jessie) ... 0 [OK]
docker.io docker.io/eeacms/debian Docker image for Debian to be used with EE... 0 [OK]
docker.io docker.io/konstruktoid/debian Debian base image 0 [OK]
docker.io docker.io/mariorez/debian Debian Containers for PHP Projects 0 [OK]
docker.io docker.io/nathonfowlie/debian-jre Latest Debian image with the JRE pre-insta... 0 [OK]
docker.io docker.io/podbox/debian 0 [OK]
docker.io docker.io/reinblau/debian Debian with usefully default packages for ... 0 [OK]
docker.io docker.io/solict/provisionous-puppet-debian Debian provisions with Puppet included 0 [OK]
docker.io docker.io/visono/debian Docker base image of debian 7 with tools i... 0 [OK]
docker.io docker.io/yaronr/debian-wheezy Debian Wheezy, 85mb, with a few extras 0 [OK]
#docker pull debian
latest: Pulling from docker.io/debian
902b87aaaec9: Pull complete
9a61b6b1315e: Already exists
docker.io/debian:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:bbc01a8af2e75ee2d951c69e9cea6390b4e669782fb2cb93b0782af087a7c1bc
Status: Downloaded newer image for docker.io/debian:latest
#docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
docker.io/debian latest 9a61b6b1315e 5 days ago 125.2 MB
#docker run --name=debian7_2 -t -i debian:latest /bin/bash
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
root@265cfb89624f:/# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 20228 1864 ? Ss 09:24 0:00 /bin/bash
root 5 0.0 0.0 17484 1124 ? R+ 09:37 0:00 ps aux
root@265cfb89624f:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="https://bugs.debian.org/"
#docker run -t -i debian:latest /bin/bash
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
root@f2f365702216:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="https://bugs.debian.org/"
root@f2f365702216:/# uname -a
Linux f2f365702216 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 GNU/Linux
root@f2f365702216:/# ip addr list
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
4: eth0: mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:01 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:1/64 scope link
valid_lft forever preferred_lft forever
root@f2f365702216:/# ip route show
default via 172.17.42.1 dev eth0
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.1
root@f2f365702216:/# apt-get update
root@f2f365702216:/# apt-get -y install openssh-server
#docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
265cfb89624f debian:latest "/bin/bash" 3 minutes ago Up 3 minutes debian7_2
f2f365702216 debian:latest "/bin/bash" 23 minutes ago Up 23 minutes modest_bell
#docker stop 265cfb89624f
#docker exec -ti 265cfb89624f /bin/bash
#docker exec -ti debian7_2 /bin/bash
#docker export f2f365702216 > debian80.tar
#cat debian80.tar | docker import - debian:8v0
#docker run --name debian7new -t -i debian:8v0 /bin/bash

4) Remapping the port about the container OS and host OS(Example with sshd)
#docker run --name=debian8sshd -p 22222:22 -t -i debian:latest /bin/bash
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
root@4a731024c50c:/# apt-get update
root@4a731024c50c:/# apt-get -y install openssh-server
root@4a731024c50c:/# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@4a731024c50c:/# apt-get -y install vim
root@4a731024c50c:/# vi /etc/ssh/sshd_config
PermitRootLogin yes
root@4a731024c50c:/# /etc/init.d/ssh restart
#ssh <HOST's IP> -p 22222
root@<HOST's IP>'s password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@4a731024c50c:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="https://bugs.debian.org/"

5) Through the method of bridge to connect the host and container OS
#/etc/init.d/network stop
#ip link add br0 type bridge -> For creating a br0
#ip link set enp0s3 master br0
#dhclient br0
#docker run --name debian7sshd --net=none -t -i debian:sshd /bin/bash
#docker inspect -f '{{.State.Pid}}' ab355fd31ff7 -> Get process id about container w/ 21750
#mkdir -p /var/run/netns
#ln -s /proc/21750/ns/net /var/run/netns/21750
#ip link add q21750 type veth peer name r21750
#ip link set q21750 master br0
#ip link set q21750 up
#ip link set r21750 netns 21750
#ip netns exec 21750 ip link set dev r21750 name eth0
#ip netns exec 21750 ip link set eth0 up
#ip netns exec 21750 ip addr add 192.168.43.220 dev eth0
#ip netns exec 21750 ip route add default via 192.168.43.1

◎、以上就是Setup and usage w/ docker under the CentOS 7.1 x64操作流程,至於上述的內容均參考網管人這篇文章,如果看倌們這個Topic有更進一步的興趣,可以到這邊自行玩味玩味,先到這,收工囉!

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro