LXCコンテナを何回か作ってきていて、疑問が出てきた。
「LXCコンテナってどうやって作ってるの?」
で、調べてみると、Scriptファイルにしたがって作っている
ことまでわかった。ちなみに、Scriptファイルは
$ ls -l /usr/share/lxc/templates
合計 336
-rwxr-xr-x 1 root root 10795 4月 29 15:46 lxc-alpine
-rwxr-xr-x 1 root root 13533 4月 29 15:46 lxc-altlinux
-rwxr-xr-x 1 root root 10253 4月 29 15:46 lxc-archlinux
-rwxr-xr-x 1 root root 9446 4月 29 15:46 lxc-busybox
-rwxr-xr-x 1 root root 28932 4月 29 15:46 lxc-centos
-rwxr-xr-x 1 root root 10150 4月 29 15:46 lxc-cirros
-rwxr-xr-x 1 root root 14131 4月 29 15:46 lxc-debian
-rwxr-xr-x 1 root root 17427 4月 29 15:46 lxc-download
-rwxr-xr-x 1 root root 47200 4月 29 15:46 lxc-fedora
-rwxr-xr-x 1 root root 27808 4月 29 15:46 lxc-gentoo
-rwxr-xr-x 1 root root 13961 4月 29 15:46 lxc-openmandriva
-rwxr-xr-x 1 root root 13705 4月 29 15:46 lxc-opensuse
-rwxr-xr-x 1 root root 35445 4月 29 15:46 lxc-oracle
-rwxr-xr-x 1 root root 11837 4月 29 15:46 lxc-plamo
-rwxr-xr-x 1 root root 6851 4月 29 15:46 lxc-sshd
-rwxr-xr-x 1 root root 24273 4月 29 15:46 lxc-ubuntu
-rwxr-xr-x 1 root root 12401 4月 29 15:46 lxc-ubuntu-cloud
フムフム、こんなのがあるんだ・・・で、常用しているdebianを
見てみると、
$ nano /usr/share/lxc/templates/lxc-debian
#!/bin/bash
#
# lxc: linux Container library
・・・・・・
中身はbashのscriptとなっているようで、順番に紐解けば自分のオリジナルコンテナも作れるようです。でも、そんなことしたら、
dockerとおんなじじゃん!
とは言え、
# configure the network using the dhcp
cat <<EOF > $rootfs/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
例えば、ココを編集すると、固定IPアドレスも設定できそうですね。
ただ、毎回編集するのは非効率な気もしますが・・・
valid_releases=('squeeze' 'wheezy' 'jessie' 'sid')
おや?ココにstretchを追加すれば、もしかしたら純粋なstretchが構築
できるのでしょうか?
valid_releases=('squeeze' 'wheezy' 'jessie' 'stretch' 'sid')
として、lxc-debian-testとして保存、
$ sudo lxc-create -n stretch02 -t debian-test -- -r stretch
・・・・・・
E: Couldn't find these debs: libui-dialog-perl
Failed to download the rootfs, aborting.
Failed to download 'debian base'
failed to install debian
lxc_container: container creation template for stretch02 failed
lxc_container: Error creating container stretch02
ん、libui-dialog-perlが無い?調べてみると、どうもstretchには
ないみたい・・・
何だか、簡単には行かないね〜(ToT)
では、また(^^)/~~
0 件のコメント :
コメントを投稿
コメントありがとうございますm(_ _)m
これからの励みになります。
どうでもいい話ですが、僕は褒められると伸びるタイプです♪