SlideShare a Scribd company logo
1 of 32
Download to read offline
●
●
●
●
●
●
● ✔
● ✔
● ✘
●
VM
●
●
●
● Docker
● Go
● 1 1
● LXC libcontainer
●
● root docker pull
● CentOS/Rocket
● Docker
●
● systemd-nspawn
● systemd
● Rocket
● MINCS
● shell script
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
$ ll /proc/$$/ns
0
lrwxrwxrwx. 1 takei takei 0 10 17 20:57 ipc -> ipc:[4026531839]
lrwxrwxrwx. 1 takei takei 0 10 17 20:57 mnt -> mnt:[4026531840]
lrwxrwxrwx. 1 takei takei 0 10 17 20:57 net -> net:[4026531992]
lrwxrwxrwx. 1 takei takei 0 10 17 20:57 pid -> pid:[4026531836]
●
●
$ readlink /proc/$$/ns/mnt # mount
mnt:[4026531840]
$ sudo unshare --mount /bin/bash # mount
# readlink /proc/$$/ns/mnt # mount
mnt:[4026532249]
# mkdir mnt; mount -t tmpfs tmpfs mnt
# mount #
# exit
●
●
●
$ mkdir src dest src/{master,slave}
# mount --bind src dest # src dest bind
# mount --make-slave dest # master slave
# mount -t tmpfs tmpfs src/master # (src)
# mount -t tmpfs tmpfs dest/slave # (dest)
$ mount
tmpfs on /home/alice/src/master type tmpfs (rw,relatime,seclabel)
●
●
●
●
●
●
●
●
●
●
$ sudo unshare --mount /bin/bash # mount
# mkdir mnt
# mount --make-private / #
# mount -t tmpfs tmpfs mnt
# mount --make-shared / #
# mount #
# exit
$ mount #
●
●
●
●
●
●
●
●
●
●
$ hostname
ip-172-31-13-102.ap-northeast-1.compute.internal
$ sudo unshare --uts
# hostname wonderland
# hostname
wonderland
# logout
$ hostname
ip-172-31-13-102.ap-northeast-1.compute.internal
●
●
●
$ sudo ip netns add test # test netns
$ sudo ip netns list #
test
$ sudo ip netns exec test /bin/bash # test
# readlink /proc/$$/ns/net # netns
net:[4026532219]
# ls -li /var/run/netns/test # /var/run/netns
4026532219 -r--r--r--. 1 root root 0 Oct 18 03:02 /run/netns/test
# ip addr # lo
●
●
$ sudo ip link add name master type veth peer name slave # veth
$ sudo ip addr #
6: slave: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 3a:64:e8:80:03:5f brd ff:ff:ff:ff:ff:ff
7: master: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 86:cf:cc:26:74:e4 brd ff:ff:ff:ff:ff:ff
$ sudo ip link set slave netns test # netns test
$ sudo ip addr #
7: master: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 86:cf:cc:26:74:e4 brd ff:ff:ff:ff:ff:ff
$ sudo ip netns exec test ip addr
6: slave: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 3a:64:e8:80:03:5f brd ff:ff:ff:ff:ff:ff
● eth (veth)
● 2. IP &
$ sudo ip addr add 192.168.50.101/24 dev master # master IP
$ sudo ip link set dev master up #
$ sudo ip netns exec test /bin/bash # bash
# ip addr add 192.168.50.102/24 dev slave # slave IP
# ip link set dev slave up #
# ping 192.168.50.101 -c1 #
PING 192.168.50.101 (192.168.50.101) 56(84) bytes of data.
64 bytes from 192.168.50.101: icmp_seq=1 ttl=64 time=0.047 ms
# exit
$ ping 192.168.50.102 -c1
net - : veth
● eth (veth)
● 3. IP &
$ sudo ip netns exec test /bin/bash
# ip route add default via 192.168.50.101 dev slave # default gw
# ip route
default via 192.168.50.101 dev slave
192.168.50.0/24 dev slave proto kernel scope link src 192.168.50.102
# exit
$ # IP
$ sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 -o eth0 -j MASQUERADE
$ sudo ip netns exec test /bin/bash
# ping 8.8.8.8 -c1 #
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=2.18 ms
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
mkdir new-root
sudo yum -y --releasever=7Server --installroot=${PWD}/new-root install 
@Core @Base redhat-release-server vim-enhanced
●
●
●
●
●
$ sudo unshare -m -p -f /bin/bash # pid/mnt
# mount --make-rprivate / # off
# mount -o loop /root.img /mnt/new-root/ # root
# cd /mnt/new-root/
# mkdir .old # root
# pivot_root . .old # pivot!
●
●
●
●
●
●
●
●
$ mkdir upper work #
$ sudo mount -t overlay 
-o lowerdir=/,upperdir=upper,workdir=work overlayfs new-root
$ touch /home/alice/file1 new-root/home/alice/file2
$ ls -l new-root/home/alice/file* #
-rw-rw-r--. 1 alice alice 0 Oct 18 12:30 new-root/home/alice/file1
-rw-rw-r--. 1 alice alice 0 Oct 18 12:30 new-root/home/alice/file2
$ rm new-root/home/alice/file1 #
$ ll upper/home/alice/file* # upper
●
●
●
●
●
●
● Docker
● 1. loop back dm-thin pool
● /var/lib/docker/devicemapper/devicemapper/{,meta}data
$ sudo systemctl start docker # docker
$ losetup # loop pool
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0 0 0 1 0 /var/lib/docker/devicemapper/devicemapper/data
/dev/loop1 0 0 1 0 /var/lib/docker/devicemapper/devicemapper/metadata
$ sudo ls -hl /var/lib/docker/devicemapper/devicemapper/ # 100G 2G ( )
total 4.5G
-rw-------. 1 root root 100G Oct 19 04:54 data
-rw-------. 1 root root 2.0G Oct 19 04:56 metadata
●
●
●
●
$ sudo du -h /var/lib/docker/devicemapper/devicemapper/data
4.4G/var/lib/docker/devicemapper/devicemapper/data
$ sudo ls -lh /var/lib/docker/devicemapper/devicemapper/data
-rw-------. 1 root root 100G Oct 19 04:54 /var/lib/docker/devicemapper/devicemapper/data
$ fallocate -o 9223372036854775807 -l 1 huge # fallocate
$ ls -lh huge; du -h huge # 8EB( )!!
-rw-r--r--. 1 alice alice 8.0E Oct 19 05:10 huge
● 2.
● 10G (RHEL7 default)
$ docker run -d centos:centos7 /sbin/init #
$ docker ps # ID
CONTAINER ID IMAGE COMMAND ...
b90ed5b981ae centos:centos7 "/sbin/init" ...
$ lsblk #
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 30G 0 part /
loop0 7:0 0 100G 0 loop
└─docker-202:2-62765-pool 253:0 0 100G 0 dm
└─docker-202:2-62765-b90ed5b981ae9d06...ee67 253:1 0 10G 0 dm
loop1 7:1 0 2G 0 loop
●
$ # id
$ sudo jq . /var/lib/docker/repositories-devicemapper
{
"Repositories": {
"test": { "latest": "a02698bf3...e5c42b" }
},
"ConfirmDefPush": true
}
$ # dm-thin
$ sudo jq . /var/lib/docker/devicemapper/metadata/a02698bf3...e5c42b
{
"device_id": 352,
"size": 10737418240,
"transaction_id": 582,
●
$ # device_id size
$ sudo jq . /var/lib/docker/devicemapper/metadata/a02698bf...5c42b
... "device_id": 352, "size": 10737418240, ...
$ #
$ lsblk
loop0
└─docker-202:2-62765-pool
$ # dm
$ sudo dmsetup create dockervol 
--table "0 $((10737418240 / 512)) thin /dev/mapper/docker-202:2-62765-pool 352"
$ # dm
$ ll /dev/mapper/dockervol
lrwxrwxrwx. 1 root root 7 Oct 19 06:10 /dev/mapper/dockervol -> ../dm-3
● ( ) docker
30
$ ll mnt/ #
total 24
-rw-------. 1 root root 64 Aug 26 23:08 id
drwx------. 2 root root 16384 Aug 26 22:58 lost+found
$ ll mnt/rootfs/ # docker (OS)
total 64
lrwxrwxrwx. 1 root root 7 Jun 18 08:34 bin -> usr/bin
drwxr-xr-x. 3 root root 4096 Oct 18 12:56 boot
:
$ sudo cat mnt/id # id id
f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639
$ docker history test:latest
IMAGE CREATED CREATED BY ...
a02698bf3120 17 hours ago /bin/sh -c yum install -y httpd
a6673f7926d7 7 weeks ago /bin/sh -c #(nop) MAINTAINER TAKEI Yuya <take
●
●
●
●
●
●
●
●
●
●
●
●
●
●
● TenForward - MINCS (1)
● http://d.hatena.ne.jp/defiant/20150701/1435749116
●
●
●
●
●
●

More Related Content

What's hot

От sysV к systemd
От sysV к systemdОт sysV к systemd
От sysV к systemdDenis Kovalev
 
3 manual installation of open vpn
3 manual installation of open vpn3 manual installation of open vpn
3 manual installation of open vpnAshwajit Maske
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by pythonwonyong hwang
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Takuya Nishimoto
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppetlutter
 
Build your own private openstack cloud
Build your own private openstack cloudBuild your own private openstack cloud
Build your own private openstack cloudNUTC, imac
 
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Stacey Whitney
 
使用 CLI 管理 OpenStack 平台
使用 CLI 管理 OpenStack 平台使用 CLI 管理 OpenStack 平台
使用 CLI 管理 OpenStack 平台NUTC, imac
 
Docker 基本概念與指令操作
Docker  基本概念與指令操作Docker  基本概念與指令操作
Docker 基本概念與指令操作NUTC, imac
 
Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2Ikuru Kanuma
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishYireo
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20DefconRussia
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin Davide Cioccia
 
MyAWR another mysql awr
MyAWR another mysql awrMyAWR another mysql awr
MyAWR another mysql awrLouis liu
 
Inspector - Node.js : Notes
Inspector - Node.js : NotesInspector - Node.js : Notes
Inspector - Node.js : NotesSubhajit Sahu
 

What's hot (18)

От sysV к systemd
От sysV к systemdОт sysV к systemd
От sysV к systemd
 
3 manual installation of open vpn
3 manual installation of open vpn3 manual installation of open vpn
3 manual installation of open vpn
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by python
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830
 
Workflow && t1k
Workflow && t1kWorkflow && t1k
Workflow && t1k
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
 
Build your own private openstack cloud
Build your own private openstack cloudBuild your own private openstack cloud
Build your own private openstack cloud
 
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
 
使用 CLI 管理 OpenStack 平台
使用 CLI 管理 OpenStack 平台使用 CLI 管理 OpenStack 平台
使用 CLI 管理 OpenStack 平台
 
Docker 基本概念與指令操作
Docker  基本概念與指令操作Docker  基本概念與指令操作
Docker 基本概念與指令操作
 
Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
 
Ubic
UbicUbic
Ubic
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
 
MyAWR another mysql awr
MyAWR another mysql awrMyAWR another mysql awr
MyAWR another mysql awr
 
Inspector - Node.js : Notes
Inspector - Node.js : NotesInspector - Node.js : Notes
Inspector - Node.js : Notes
 

Similar to PFIセミナー資料 H27.10.22

Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemCyber Security Alliance
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Openstack 101
Openstack 101Openstack 101
Openstack 101POSSCON
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
A little systemtap
A little systemtapA little systemtap
A little systemtapyang bingwu
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDocker, Inc.
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterAndrey Kudryavtsev
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Jian-Hong Pan
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Defcon CTF quals
Defcon CTF qualsDefcon CTF quals
Defcon CTF qualssnyff
 
glance replicator
glance replicatorglance replicator
glance replicatoririx_jp
 
Qt native built for raspberry zero
Qt native built for  raspberry zeroQt native built for  raspberry zero
Qt native built for raspberry zeroSoheilSabzevari2
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOpsandersjanmyr
 
Velocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackVelocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackCosimo Streppone
 
x86_64 Hardware Deep dive
x86_64 Hardware Deep divex86_64 Hardware Deep dive
x86_64 Hardware Deep diveNaoto MATSUMOTO
 

Similar to PFIセミナー資料 H27.10.22 (20)

Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Openstack 101
Openstack 101Openstack 101
Openstack 101
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
A little systemtap
A little systemtapA little systemtap
A little systemtap
 
Ubic-public
Ubic-publicUbic-public
Ubic-public
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
 
Docker command
Docker commandDocker command
Docker command
 
Multipath
MultipathMultipath
Multipath
 
Defcon CTF quals
Defcon CTF qualsDefcon CTF quals
Defcon CTF quals
 
glance replicator
glance replicatorglance replicator
glance replicator
 
Qt native built for raspberry zero
Qt native built for  raspberry zeroQt native built for  raspberry zero
Qt native built for raspberry zero
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOps
 
Velocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackVelocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attack
 
Linux: LVM
Linux: LVMLinux: LVM
Linux: LVM
 
Haproxy - zastosowania
Haproxy - zastosowaniaHaproxy - zastosowania
Haproxy - zastosowania
 
x86_64 Hardware Deep dive
x86_64 Hardware Deep divex86_64 Hardware Deep dive
x86_64 Hardware Deep dive
 

Recently uploaded

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Recently uploaded (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

PFIセミナー資料 H27.10.22

  • 1.
  • 4. ● ● ● ● Docker ● Go ● 1 1 ● LXC libcontainer ● ● root docker pull
  • 5. ● CentOS/Rocket ● Docker ● ● systemd-nspawn ● systemd ● Rocket ● MINCS ● shell script ●
  • 8. ● ● ● ● ● $ ll /proc/$$/ns 0 lrwxrwxrwx. 1 takei takei 0 10 17 20:57 ipc -> ipc:[4026531839] lrwxrwxrwx. 1 takei takei 0 10 17 20:57 mnt -> mnt:[4026531840] lrwxrwxrwx. 1 takei takei 0 10 17 20:57 net -> net:[4026531992] lrwxrwxrwx. 1 takei takei 0 10 17 20:57 pid -> pid:[4026531836]
  • 9. ● ● $ readlink /proc/$$/ns/mnt # mount mnt:[4026531840] $ sudo unshare --mount /bin/bash # mount # readlink /proc/$$/ns/mnt # mount mnt:[4026532249] # mkdir mnt; mount -t tmpfs tmpfs mnt # mount # # exit
  • 10. ● ● ● $ mkdir src dest src/{master,slave} # mount --bind src dest # src dest bind # mount --make-slave dest # master slave # mount -t tmpfs tmpfs src/master # (src) # mount -t tmpfs tmpfs dest/slave # (dest) $ mount tmpfs on /home/alice/src/master type tmpfs (rw,relatime,seclabel)
  • 12. ● ● $ sudo unshare --mount /bin/bash # mount # mkdir mnt # mount --make-private / # # mount -t tmpfs tmpfs mnt # mount --make-shared / # # mount # # exit $ mount #
  • 14. ● ● $ hostname ip-172-31-13-102.ap-northeast-1.compute.internal $ sudo unshare --uts # hostname wonderland # hostname wonderland # logout $ hostname ip-172-31-13-102.ap-northeast-1.compute.internal
  • 15. ● ● ● $ sudo ip netns add test # test netns $ sudo ip netns list # test $ sudo ip netns exec test /bin/bash # test # readlink /proc/$$/ns/net # netns net:[4026532219] # ls -li /var/run/netns/test # /var/run/netns 4026532219 -r--r--r--. 1 root root 0 Oct 18 03:02 /run/netns/test # ip addr # lo
  • 16. ● ● $ sudo ip link add name master type veth peer name slave # veth $ sudo ip addr # 6: slave: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 3a:64:e8:80:03:5f brd ff:ff:ff:ff:ff:ff 7: master: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 86:cf:cc:26:74:e4 brd ff:ff:ff:ff:ff:ff $ sudo ip link set slave netns test # netns test $ sudo ip addr # 7: master: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 86:cf:cc:26:74:e4 brd ff:ff:ff:ff:ff:ff $ sudo ip netns exec test ip addr 6: slave: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 3a:64:e8:80:03:5f brd ff:ff:ff:ff:ff:ff
  • 17. ● eth (veth) ● 2. IP & $ sudo ip addr add 192.168.50.101/24 dev master # master IP $ sudo ip link set dev master up # $ sudo ip netns exec test /bin/bash # bash # ip addr add 192.168.50.102/24 dev slave # slave IP # ip link set dev slave up # # ping 192.168.50.101 -c1 # PING 192.168.50.101 (192.168.50.101) 56(84) bytes of data. 64 bytes from 192.168.50.101: icmp_seq=1 ttl=64 time=0.047 ms # exit $ ping 192.168.50.102 -c1
  • 18. net - : veth ● eth (veth) ● 3. IP & $ sudo ip netns exec test /bin/bash # ip route add default via 192.168.50.101 dev slave # default gw # ip route default via 192.168.50.101 dev slave 192.168.50.0/24 dev slave proto kernel scope link src 192.168.50.102 # exit $ # IP $ sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 -o eth0 -j MASQUERADE $ sudo ip netns exec test /bin/bash # ping 8.8.8.8 -c1 # PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=2.18 ms
  • 20. ● ● ● ● ● ● mkdir new-root sudo yum -y --releasever=7Server --installroot=${PWD}/new-root install @Core @Base redhat-release-server vim-enhanced
  • 21. ● ● ● ● ● $ sudo unshare -m -p -f /bin/bash # pid/mnt # mount --make-rprivate / # off # mount -o loop /root.img /mnt/new-root/ # root # cd /mnt/new-root/ # mkdir .old # root # pivot_root . .old # pivot!
  • 23. ● ● ● $ mkdir upper work # $ sudo mount -t overlay -o lowerdir=/,upperdir=upper,workdir=work overlayfs new-root $ touch /home/alice/file1 new-root/home/alice/file2 $ ls -l new-root/home/alice/file* # -rw-rw-r--. 1 alice alice 0 Oct 18 12:30 new-root/home/alice/file1 -rw-rw-r--. 1 alice alice 0 Oct 18 12:30 new-root/home/alice/file2 $ rm new-root/home/alice/file1 # $ ll upper/home/alice/file* # upper
  • 25. ● Docker ● 1. loop back dm-thin pool ● /var/lib/docker/devicemapper/devicemapper/{,meta}data $ sudo systemctl start docker # docker $ losetup # loop pool NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 1 0 /var/lib/docker/devicemapper/devicemapper/data /dev/loop1 0 0 1 0 /var/lib/docker/devicemapper/devicemapper/metadata $ sudo ls -hl /var/lib/docker/devicemapper/devicemapper/ # 100G 2G ( ) total 4.5G -rw-------. 1 root root 100G Oct 19 04:54 data -rw-------. 1 root root 2.0G Oct 19 04:56 metadata
  • 26. ● ● ● ● $ sudo du -h /var/lib/docker/devicemapper/devicemapper/data 4.4G/var/lib/docker/devicemapper/devicemapper/data $ sudo ls -lh /var/lib/docker/devicemapper/devicemapper/data -rw-------. 1 root root 100G Oct 19 04:54 /var/lib/docker/devicemapper/devicemapper/data $ fallocate -o 9223372036854775807 -l 1 huge # fallocate $ ls -lh huge; du -h huge # 8EB( )!! -rw-r--r--. 1 alice alice 8.0E Oct 19 05:10 huge
  • 27. ● 2. ● 10G (RHEL7 default) $ docker run -d centos:centos7 /sbin/init # $ docker ps # ID CONTAINER ID IMAGE COMMAND ... b90ed5b981ae centos:centos7 "/sbin/init" ... $ lsblk # NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 30G 0 disk ─xvda1 202:1 0 1M 0 part └─xvda2 202:2 0 30G 0 part / loop0 7:0 0 100G 0 loop └─docker-202:2-62765-pool 253:0 0 100G 0 dm └─docker-202:2-62765-b90ed5b981ae9d06...ee67 253:1 0 10G 0 dm loop1 7:1 0 2G 0 loop
  • 28. ● $ # id $ sudo jq . /var/lib/docker/repositories-devicemapper { "Repositories": { "test": { "latest": "a02698bf3...e5c42b" } }, "ConfirmDefPush": true } $ # dm-thin $ sudo jq . /var/lib/docker/devicemapper/metadata/a02698bf3...e5c42b { "device_id": 352, "size": 10737418240, "transaction_id": 582,
  • 29. ● $ # device_id size $ sudo jq . /var/lib/docker/devicemapper/metadata/a02698bf...5c42b ... "device_id": 352, "size": 10737418240, ... $ # $ lsblk loop0 └─docker-202:2-62765-pool $ # dm $ sudo dmsetup create dockervol --table "0 $((10737418240 / 512)) thin /dev/mapper/docker-202:2-62765-pool 352" $ # dm $ ll /dev/mapper/dockervol lrwxrwxrwx. 1 root root 7 Oct 19 06:10 /dev/mapper/dockervol -> ../dm-3
  • 30. ● ( ) docker 30 $ ll mnt/ # total 24 -rw-------. 1 root root 64 Aug 26 23:08 id drwx------. 2 root root 16384 Aug 26 22:58 lost+found $ ll mnt/rootfs/ # docker (OS) total 64 lrwxrwxrwx. 1 root root 7 Jun 18 08:34 bin -> usr/bin drwxr-xr-x. 3 root root 4096 Oct 18 12:56 boot : $ sudo cat mnt/id # id id f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639 $ docker history test:latest IMAGE CREATED CREATED BY ... a02698bf3120 17 hours ago /bin/sh -c yum install -y httpd a6673f7926d7 7 weeks ago /bin/sh -c #(nop) MAINTAINER TAKEI Yuya <take
  • 32. ● ● ● ● ● ● ● TenForward - MINCS (1) ● http://d.hatena.ne.jp/defiant/20150701/1435749116 ● ● ● ● ● ●