无法在OpenStack中创建docker容器

时间:2015-06-22 08:19:46

标签: docker openstack

我在多节点OpenStack(版本Juno)上设置nova-docker(docker hypervisor)有问题,我的操作系统是Ubuntu 14.04 我跟着:https://wiki.openstack.org/wiki/Docker,当我通过仪表板或nova启动创建容器vm时,我在nova-compute.log中收到错误

2015-06-22 14:41:40.059 2550 **ERROR nova.compute.manager [-] [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105] Instance failed to spawn**
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105] Traceback (most recent call last):
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2267, in _build_resources
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]     yield resources
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2137, in _build_and_run_instance
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]     block_device_info=block_device_info)
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]   File "/usr/local/lib/python2.7/dist-packages/novadocker/virt/docker/driver.py", line 301, in spawn
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]     **instance_id=instance['name'])**
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105] **InstanceDeployFailure: Cannot create container**
2015-06-22 14:41:40.059 2550 TRACE nova.compute.manager [instance: 62d7a3d3-7008-44d7-b17f-129b4c10c105]

**** UPDATE ****** docker debug中出错: docker -d -D

INFO[0000] Docker daemon                                 commit=0baf609 execdriver=native-0.2 graphdriver=aufs version=1.7.0    
DEBU[0018] Calling GET /images/{name:.*}/json           
INFO[0018] GET /v1.13/images/tutum/mysql/json           
DEBU[0018] Calling POST /containers/create              
INFO[0018] POST /v1.13/containers/create?name=nova-0e24a2ef-57f3-421e-b357-6cbc71dbe15b 
ERRO[0018] **Handler for POST /containers/create returned error: json: cannot unmarshal string into Go value of type []string** 
ERRO[0018] **HTTP Error                                    err=json: cannot unmarshal string into Go value of type []string statusCode=500**
DEBU[0018] Calling GET /containers/ps                   
INFO[0018] GET /v1.13/containers/ps?all=1               
DEBU[0018] Calling GET /containers/{name:.*}/json       
INFO[0018] GET /v1.13/containers/86bbca94cb7cf4a8dc81c4eaba55a46ca92c9e6bb8b79b63dfdb1466bee15233/json 
DEBU[0018] Calling GET /containers/ps                   
INFO[0018] GET /v1.13/containers/ps?all=1               
DEBU[0018] Calling GET /containers/{name:.*}/json       
INFO[0018] GET /v1.13/containers/86bbca94cb7cf4a8dc81c4eaba55a46ca92c9e6bb8b79b63dfdb1466bee15233/json 
  • 我的配置:

/etc/nova/nova.conf

  [DEFAULT]
    compute_driver = novadocker.virt.docker.DockerDriver
    network_api_class = nova.network.neutronv2.api.API
    security_group_api = neutron
    linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    dhcpbridge_flagfile=/etc/nova/nova.conf
    dhcpbridge=/usr/bin/nova-dhcpbridge
    logdir=/var/log/nova
    state_path=/var/lib/nova
    lock_path=/var/lock/nova
    force_dhcp_release=True
    libvirt_use_virtio_for_bridges=True
    verbose=True
    ec2_private_dns_show_ip=True
    api_paste_config=/etc/nova/api-paste.ini
    enabled_apis=ec2,osapi_compute,metadata

    rpc_backend = rabbit
    rabbit_host = controller
    rabbit_password = openstack 


    rbd_user=volumes
    rbd_secret_uuid=f514c965-78b3-46ed-b986-838b3cb91655


    instance_usage_audit = True
    instance_usage_audit_period = hour
    notify_on_state_change = vm_and_task_state
    notification_driver = messagingv2

    my_ip = 10.0.0.33
    vnc_enabled = True
    vncserver_listen = 0.0.0.0
    vncserver_proxyclient_address = 10.0.0.33
    novncproxy_base_url = http://controller:6080/vnc_auto.html
    auth_strategy = keystone
    [keystone_authtoken]
    auth_uri = http://controller:5000/v2.0
    identity_uri = http://controller:35357
    admin_tenant_name = service
    admin_user = nova
    admin_password = openstack 

    [glance]
    host = controller


    [neutron]
    url = http://controller:9696
    auth_strategy = keystone
    admin_auth_url = http://controller:35357/v2.0
    admin_tenant_name = service
    admin_username = neutron
    admin_password = openstack
    service_metadata_proxy = True
    metadata_proxy_shared_secret = af5a6fbca1ef8da0d018


    #[libvirt]
    #live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_TUNNELLED

/etc/nova/nova-compute.conf

[DEFAULT]
compute_driver = novadocker.virt.docker.DockerDriver
#[libvirt]
#virt_type=kvm

/etc/nova/rootwrap.d/docker.filters

# nova-rootwrap command filters for setting up network in the docker driver
# This file should be owned by (and only-writeable by) the root user

[Filters]
# nova/virt/docker/driver.py: 'ln', '-sf', '/var/run/netns/.*'
ln: CommandFilter, /bin/ln, root

/etc/glance/glance-api.conf在控制器节点

.....
container_formats = ami,ari,aki,bare,ovf,docker
....

我上传了一个图片泊坞窗:

root@compute3:~# glance image-list
+--------------------------------------+-------------------+-------------+------------------+------------+--------+
| ID                                   | Name              | Disk Format | Container Format | Size       | Status |
+--------------------------------------+-------------------+-------------+------------------+------------+--------+
| 0b20f57c-0862-42dc-a705-eb415832fff0 | cirros32-ceph     | qcow2       | bare             | 12336128   | active |
| 4b591eba-8fc1-409a-8d39-35ab792811c6 | tutum/wordpress   | raw         | docker           | 507855360  | active |
+--------------------------------------+-------------------+-------------+------------------+------------+--------+

root@compute3:~# docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
tutum/wordpress          latest              a540e82bd70a        5 weeks ago         492.3 MB
hello-world              latest              91c95931e552        9 weeks ago         910 B
bacongobbler/memcached   latest              81ed21c66f64        15 months ago       263.7 MB

任何人都可以帮助我吗?,谢谢大家!

1 个答案:

答案 0 :(得分:0)

本周Docker的更新从1.6.2升级到1.7.0。这个更新版本显然不支持1.14以下的任何版本的api。 nova-docker驱动程序使用1.13 api。目前解决方案是降级到docker 1.6.2(apt-get purge lxc-docker-1.7.0&& apt-get install lxc-docker-1.6.2)。希望nova docker驱动程序将在不久的将来更新以支持更新版本的API。

更新:问题似乎是novadocker驱动程序传递默认的VolumesFrom值“”(空字符串),当更新版本的docker希望它为空值时。我目前正试图弄清楚这是否应该被认为是docker或novadocker驱动程序中的错误。