参考
- Linux Containers - LXD - はじめに - コマンドライン
- Ubuntu 16.04 LTSでLXD 2.0をセットアップして使ってみる · hnakamur's blog at github
setup-alpine
isoブートしsetup-alipine実行
- jp
- alpine
- [eth0]
- 192.168.9.51/24
- 192.168.9.1
- []
- []
- 8.8.8.8
- password1
- password2
- Asia/Tokyo
- []
- [f]
- [openssh]
- [chrony]
- sda
- sys
- y
reboot
再起動後
vi /etc/apk/repositories
# edge をコメントアウト
apk update
#
apk add lxc lxd
# ネットワーク設定用
apk add dnsmasq iptables ip6tables
# ブリッジインターフェース用
apk add bridge-utils
# ssl通信用
apk add ca-certificates openssl
rc-update add lxd default
起動スクリプト追加
- このままでは
service lxd start
でlxd dameon
が起動しないため以下修正
/etc/init.d/lxd
#!/sbin/openrc-run
# (c) 2016 Alpine Linux
command="/usr/sbin/lxd"
command_args="${LXD_OPTIONS}"
command_background="true"
pidfile="/var/run/${RC_SVCNAME}.pid"
depend() {
need net
use lxcfs
after firewall
}
+ start() {
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --background --exec \
+ $command $command_args daemon
+ eend $?
+ }
lxdの設定
# lxd daemon
service lxd start
lxd init --auto
$ lxc image list images: centos
+------------------------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE |
+------------------------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
| centos/6 (3 more) | 37b6a126b5af | yes | Centos 6 amd64 (20170211_02:16) | x86_64 | 124.95MB | Feb 11, 2017 at 12:00am (UTC) |
+------------------------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
| centos/6/i386 (1 more) | b8d9470a1866 | yes | Centos 6 i386 (20170211_02:16) | i686 | 121.95MB | Feb 11, 2017 at 12:00am (UTC) |
+------------------------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
| centos/7 (3 more) | 3f220a619aba | yes | Centos 7 amd64 (20170211_02:16) | x86_64 | 65.23MB | Feb 11, 2017 at 12:00am (UTC) |
+------------------------+--------------+--------+---------------------------------+--------+----------+-------------------------------+
# lxc launch images:centos/6 cent01
lxc launch images:centos/6 cent01 -c security.privileged=true
lxc network attach lxdbr0 cent01
lxc start cent01 # <- 起動しない・・・。
lxc info cent01
lxc list
lxc exec cent01 -- bash # <- 起動しない・・・。
lxdのアンインストール
rc-update del lxd default
apk del lxd
rm -r /var/lib/lxd
ip link set lxdbr0 down
brctl delbr lxdbr0
reboot
トラブルシューティング
error: Get https://images.linuxcontainers.org/streams/v1/index.json: x509: failed to load system roots and no roots provided
wget https://images.linuxcontainers.org/streams/v1/index.json
wget: can't execute 'ssl_helper': No such file or directory
- ca-certificates, openssl パッケージを入れる。