LXD
REST APIセットアップ
code:a.sh
lxc config set core.https_address ":::8443" lxc config set core.trust_password "password"
[-- クライアント証明書は lxd init 時に生成される]
remote addすると生成される
code:a.sh
# lxc remote add api 127.0.0.1:8443
Generating a client certificate. This may take a minute...
Certificate fingerprint: xxxxxx
ok (y/n)? y
Admin password for api:
Client certificate stored at server: api
# ls -l snap/lxd/current/.config/lxc/
total 16
-rw-r--r-- 1 root root 749 Feb 10 19:03 client.crt
-rw------- 1 root root 288 Feb 10 19:03 client.key
-rw-r--r-- 1 root root 304 Feb 10 19:03 config.yml
drwxr-x--- 2 root root 4096 Feb 10 19:03 servercerts
Dockerが動かせるコンテナ
code:a.sh
lxc launch ubuntu:18.04 -c security.nesting=true -c security.privileged=true
過去ログ
snap packageで入れたなら /var/snap/lxd/common/lxd/logs/ にある
リソースを制限する
limits を使うとcgroup経由でリソースの制限ができる。top free などで見えるリソースが変わる(再起動不要)
code:a.sh
lxc config set magical-narwhal limits.cpu 2
lxc config set magical-narwhal limits.memory 1GB