Ask Your Question
0

Container is not started with heat

asked 2014-07-21 09:05:56 -0600

andreyo gravatar image

Hi,

I'm trying to deploy Docker container using Heat plugin in Icehouse Openstack. The Heat stack launch is completed successfully and in the docker.log file I can see the following:

2014/07/21 12:59:39 POST /v1.9/containers/create
[2bcfd418] +job create()
[2bcfd418] -job create() = OK (0)
2014/07/21 12:59:40 POST /v1.9/containers/d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af/start
[2bcfd418] +job start(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af)
[2bcfd418] +job allocate_interface(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af)
[2bcfd418] -job allocate_interface(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af) = OK (0)
[2bcfd418] -job start(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af) = OK (0)
2014/07/21 12:59:42 GET /v1.9/containers/d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af/json
[2bcfd418] +job container_inspect(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af)
[2bcfd418] -job container_inspect(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af) = OK (0)
[2bcfd418] +job release_interface(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af)
[2bcfd418] -job release_interface(d7ad884141523f09861368f99c3e8b70abf3c5a283fc628adde4b28e4c80a9af) = OK (0)

So, everything looks fine, but the container is not running. For: "docker ps -a" I get:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                          PORTS               NAMES
d7ad88414152        busybox:latest      /bin/sh             51 minutes ago      Exited (0) 51 minutes ago                           elegant_ardinghelli

Note that the container was created and exited at the same time. I've tried to start it with: "docker start <id>" , but it's not working either.

I can create a container with "docker run ..." and then start it with no problem. I guess there is some kind of problem with docker remote API.

Please advise. Regards, Andrey

edit retag flag offensive close merge delete

Comments

Try using CLI:

curl -o install-docker.sh http://get.docker.io/

And then booted an instance using

nova boot --user-data install-docker.sh --flavor m1.small -image ubuntu-trusy-amd64 --key-name mykey docker0

And assigned a floating ip:

nova floating-ip-assocaite docker0 192.168.200.6
SGPJ gravatar imageSGPJ ( 2014-07-21 10:30:28 -0600 )edit

Thank you for the response.

This is kind of what I did in a first place. The docker installed fine and I can login to the instance and run docker containers. But then I try to use heat to deploy container on the instance and the container is got created and then exit immediately. I want the container up and running. Below is the template that I use to deploy the container:

heat_template_version: 2013-05-23

resources:
  my_docker_container:
    type: DockerInc::Docker::Container
    properties:
      docker_endpoint: {"Fn::Join": ["",["http://", "<IP:PORT>", ]]}
      image: cirros

The question is why the container exit immediately instead of stay up and running.

andreyo gravatar imageandreyo ( 2014-07-22 09:04:40 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
2

answered 2015-09-24 23:14:46 -0600

daikk115 gravatar image

I have a same problem and I fixed it by adding the line: "tty: true" in file template:

heat_template_version: 2013-05-23
description: An example of using the Docker plugin for Heat.

resources:
  docker_webserver:
    type: "DockerInc::Docker::Container"
    properties:
      docker_endpoint: "tcp://192.168.50.157:2375"
      image: "blast:v4"
      tty: true

p/s: with image cirros, i do not need add the line above, the container can still run.

edit flag offensive delete link more
1

answered 2015-09-24 16:51:50 -0600

Steve Baker gravatar image

The heat project strongly discourages the use of the DockerInc::Docker::Container resource. I would recommend you try the heat-container-agent approach so that you can deploy containers with heat config and deployment resources. Here is an example template using Fedora Atomic.

edit flag offensive delete link more
1

answered 2015-09-25 01:47:10 -0600

SGPJ gravatar image

Use Magnum for docker based setup in Openstack: Magnum link

Thanks, Shankar Ganesh P J

edit flag offensive delete link more

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

2 followers

Stats

Asked: 2014-07-21 09:05:56 -0600

Seen: 276 times

Last updated: Sep 25 '15