在docker中安装cloudstack-management时,执行cloudstack-setup-management中间会执行下面一个脚本
/bin/bash /usr/share/cloudstack-common/scripts/vm/systemvm/injectkeys.sh \
/var/cloudstack/management/.ssh/id_rsa.pub \
/var/cloudstack/management/.ssh/id_rsa \
/usr/share/cloudstack-common/vms/systemvm.iso
在docker中提示
Injected public and private keys into systemvm iso with result : mount: Could not find any loop device. Maybe this kernel does not know
about the loop device? (If so, recompile or `modprobe loop'.)
经查,是docker容器中没有loop device(使用losetup -f)
使用下面命令启动容器可以解决
docker run -d -it --privileged=true --name cloudstack-management-4.5.2-test \
-p 8081:8080 -p 8097:8096 -p 8788:8787 -p 8251:8250 -p 9091:9090 centos6.5/cloudstack-management-4.4.1 /bin/bash
注:--privileged=true是为了在容器中能访问loop设备,还有其他的方法,
The quick answer
docker run --privileged=true ...
An alternative
sudo losetup /dev/loop0 test.img
mount /dev/loop0 /mnt
docker run -v /mnt:/mnt ...
This almost works
docker run --device=/dev/loop-control:/dev/loop-control --device=/dev/loop0:/dev/loop0 --cap-add SYS_ADMIN ...
service mysqld start
cloudstack-setup-databases cloud:password@localhost --deploy-as=root(若容器IP改变,重新生成db.propery)
cloudstack-setup-management
(该执行脚本的调用脚本修改了两处地方,
一是iptable设置,修改不进行iptables修改;
二是对/etc/security/limits.conf 修改-1为4096
cloud hard nofile 4096
cloud soft nofile 4096)
/bin/bash /usr/share/cloudstack-common/scripts/vm/systemvm/injectkeys.sh \
/var/cloudstack/management/.ssh/id_rsa.pub \
/var/cloudstack/management/.ssh/id_rsa \
/usr/share/cloudstack-common/vms/systemvm.iso
在docker中提示
Injected public and private keys into systemvm iso with result : mount: Could not find any loop device. Maybe this kernel does not know
about the loop device? (If so, recompile or `modprobe loop'.)
经查,是docker容器中没有loop device(使用losetup -f)
使用下面命令启动容器可以解决
docker run -d -it --privileged=true --name cloudstack-management-4.5.2-test \
-p 8081:8080 -p 8097:8096 -p 8788:8787 -p 8251:8250 -p 9091:9090 centos6.5/cloudstack-management-4.4.1 /bin/bash
注:--privileged=true是为了在容器中能访问loop设备,还有其他的方法,
The quick answer
docker run --privileged=true ...
An alternative
sudo losetup /dev/loop0 test.img
mount /dev/loop0 /mnt
docker run -v /mnt:/mnt ...
This almost works
docker run --device=/dev/loop-control:/dev/loop-control --device=/dev/loop0:/dev/loop0 --cap-add SYS_ADMIN ...
但未测试
新建loop设备
mknod -m 0660 /dev/loopX b 7 X
注意loopX对应的X
例如新建一个loop3
mknod -m 0660 /dev/loop3 b 7 3
service mysqld start
cloudstack-setup-databases cloud:password@localhost --deploy-as=root(若容器IP改变,重新生成db.propery)
cloudstack-setup-management
(该执行脚本的调用脚本修改了两处地方,
一是iptable设置,修改不进行iptables修改;
二是对/etc/security/limits.conf 修改-1为4096
cloud hard nofile 4096
cloud soft nofile 4096)