Ask Your Question
0

Docker driver for OpenStack Kilo omits "Cmd"-attribute during "containers/create" REST API call provoking a "no command specified" error

asked 2015-07-17 05:52:10 -0500

holger-king gravatar image

updated 2015-07-17 07:08:18 -0500

Dear OpenStack docker driver community,

when running:

  • OpenStack Kilo
  • Docker 1.6.2 (Client API version 1.18)
  • OpenStack nova docker driver (origin/stable/kilo)

on a RHEL 7.1 operating system we observe the following error when trying to launch a docker instance via the Horizon dashboard to start:

ERROR nova.compute.manager [-] [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c] Instance failed to spawn
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c] Traceback (most recent call last):
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2442, in _build_resources
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     yield resources
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2314, in _build_and_run_instance
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     block_device_info=block_device_info)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/novadocker/virt/docker/driver.py", line 442, in spawn
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     container_id = self._create_container(instance, image_name, args)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/novadocker/virt/docker/driver.py", line 695, in _create_container
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     return self.docker.create_container(image_name, **args)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/novadocker/virt/docker/client.py", line 36, in wrapper
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     out = f(*args, **kwds)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/docker/client.py", line 239, in create_container
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     return self.create_container_from_config(config, name)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/novadocker/virt/docker/client.py", line 36, in wrapper
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     out = f(*args, **kwds)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/docker/client.py", line 247, in create_container_from_config
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     return self._result(res, True)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/docker/clientbase.py", line 106, in _result
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     self._raise_for_status(response)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]   File "/usr/lib/python2.7/site-packages/docker/clientbase.py", line 102, in _raise_for_status
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c]     raise errors.APIError(e, response, explanation=explanation)
TRACE nova.compute.manager [instance: f1d67e56-43f9-4f42-bde6-90c527efa84c] APIError: 500 Server Error: Internal Server Error ("No command specified")

The reason is quite clear: the generated OpenStack nova-docker driver JSON structure for the docker REST API call "containers/create" does not contain a "Cmd"-attribute where the command to start within the container is being specified! Even - it would be sufficient to set "Cmd":"None".

A simple example based on CURL shows and confirms our observations:

curl -X POST -H "Content-Type: application/json" http://localhost:5555/containers/create -d '{"Tty":false,"AttachStderr":true,"NetworkDisabled":true,"Image":"docker.io/fedora:latest","Hostname":"instance-00000036","StdinOnce":false,"AttachStdin":false,"Env":[],"Memory":536870912,"MemorySwap":0,"CpuShares":1024,"AttachStdout":true,"OpenStdin": false}'

As soon as we append a "Cmd" attribute either set to ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-07-17 06:46:18 -0500

dbaxps gravatar image

updated 2015-07-17 06:51:04 -0500

Actually, the problem is Dockerfile been used by your container :-

FROM scratch
MAINTAINER Lokesh Mandvekar <lsm5@fedoraproject.org>
ADD fedora-22-release.tar.xz /

Test any of this Docker images having Dockerfile with CMD line not empty :-

rastasheep/ubuntu-sshd:14.04

OR

    git clone https://github.com/tutumcloud/tutum-fedora.git
    cd tutum-fedora.git
    docker build -t tutum/fedora:21 21/
    Upload tutum/fedora:21 to glance with native name and launch NovaDocker instance

Details here Uploading and launching tutum/fedora:21 NovaDocker container

edit flag offensive delete link more

Comments

That was really helpful :-) Bingo!

holger-king gravatar imageholger-king ( 2015-07-17 07:10:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-07-17 05:52:10 -0500

Seen: 407 times

Last updated: Jul 17 '15