0

I want to orchestrate a docker container for RYU controller. I found a tutorial of how to create and run one which works rather well and I planned to compose cloudify blueprint according to the tutorial. I failed to deal with

docker run -i -t -p 0.0.0.0:6633:6633 --name ryu3.15 muzixing/ryu:SDN /bin/bash

I'm at loss of where to put "/bin/bash". I tried this way

node_tamplates:
  ...
    interfaces:
      cloudify.interfaces.circle
        create:
          implementation: docker.docker_plugin.tasks.create_container
          inputs:
            params:
              stdin_open: true
              tty: true
              command: /bin/bash
  ...

But it finishes with a 400 client error 'No Command Specified', just like "/bin/bash" missed.

I've read cloudify docs and examples, finding no effective methods to solve the problem. So does anyone know the appropriate option to pass on "/bin/bash" or where I can learn more options?

Thanks in advance.


Update:

According to cloudify docs, I checked those permitted parameters

def create_container(self, image, command=None, hostname=None, user=None,
                     detach=False, stdin_open=False, tty=False,
                     mem_limit=None, ports=None, environment=None,
                     dns=None, volumes=None, volumes_from=None,
                     network_disabled=False, name=None, entrypoint=None,
                     cpu_shares=None, working_dir=None, domainname=None,
                     memswap_limit=None, cpuset=None, host_config=None,
                     mac_address=None, labels=None, volume_driver=None,
                     stop_signal=None, networking_config=None,
                     healthcheck=None, stop_timeout=None):
...

on https://github.com/docker/docker-py/blob/master/docker/api/container.py

As /bin/bash is to start a terminal and more like a path, I attempted again by working_dir: /bin/bash. The problem remains.

So would any proficient like to share some ideas seeing the parameters?

Lootii
  • 3
  • 3

1 Answers1

1

I believe that you have to implement it in a different way.

You can look at the example code below:

 some_container:
type: cloudify.docker.Container
properties:
  name: some_name
  image:
    repository: dockeruser/dockerrepo
interfaces:
  cloudify.interfaces.lifecycle:
    create:
      implementation: docker.docker_plugin.tasks.create_container
      inputs:
        params:
          ports:
            - 8080
          stdin_open: true
          tty: true
          command: /bin/sleep 20
    start:
      implementation: docker.docker_plugin.tasks.start
      inputs:
        params:
          port_bindings:
            8080: 8080

If you need more examples you can find at http://docs.getcloudify.org/4.0.0/plugins/docker/

  • Thanks for your attention. I did notice `command: /bin/bash 20`, but have no idea of what the number means. Since you bring it up, I'll reconsider. – Lootii May 02 '17 at 07:32