action bluemix_post_containers_create { label: "Create and start a single container" description: "This endpoint creates and starts a single container in your space based on the Docker image that is specified in the Image field of the request json. A single container in IBM Containers is similar to a container that you create in your local Docker environment. Single containers are a good way to start with IBM Containers and to learn about how containers work in the IBM Cloud and the features that IBM Containers provides. They are also recommended when you want to run simple app tests or during the development process of an app. \n\n In the Docker API there are two separate APIs to create and start a container. However in IBM Containers a container is created and started in a single API call. Therefore, this API merges parameters from the Docker API to create and start container. \n\n To create a container with IBM Containers, you must at least define the image that the container is based on.\n\n- Image: You must include the full path to the image in your private Bluemix registry in the format: `registry.ng.bluemix.net//`." provider: bluemix method: POST path: "/containers/create" encoding: json input: { type: "object" properties: { BluemixApp: { type: "string" description: "The name of the Cloud Foundry app that you want to bind to your container. The Cloud Foundry app must be created in the same space where you want to create your container." } Cmd: { type: "array" description: "The command and arguments in this list are passed to the container to be executed when the container is started. This command must be a long-running command. Do not use a short-lived command, for example, /bin/date, because it might cause the container to crash.
Sample long-running commands:
[\"ping\",\"localhost\"]
[\"tail\",\"-f\",\"/dev/null\"]
[\"sh\",\"-c\",\"while true; do date; sleep 20; done\"]\n" items: { type: "string" } } Cpuset: { type: "string" description: "Pins the container processes to a specific CPU core on the compute host. For example: 0 means that processes are executed on the first core only." } Env: { type: "array" description: "A list of environment variables in the form of key=value pairs. All keys in this list have to be unique. List multiple keys separately and if you include quotation marks, include them around both the environment variable name and the value." items: { type: "string" } } ExposedPorts: { type: "array" description: "All public ports that need to be exposed for the container, so the container can be accessed from the Internet." items: { type: "string" } } HostConfig: { type: "object" properties: { Binds: { type: "array" description: "A list of volumes to be bound to the container. Each volume must be listed in the following format: VOLNAME:/CONTAINER_PATH:rw [ro]. " items: { type: "string" } } ExtraHosts: { type: "array" description: "A list of hostnames/IP mappings to be added to the container’s /etc/hosts file. Specified in the form [\"hostname:IP\"]\n" items: { type: "string" } } Links: { type: "array" description: "A list of containers that need to be linked." items: { type: "string" } } PortBindings: { type: "array" description: "The container ports that you want to expose to the public. Ports need to be specified in the form of <port>/<protocol>: [{ \"HostIp\": \"<IP>\", \"HostPort\": \"<port>\" }]\n" items: { type: "string" } } } } Image: { type: "string" description: "Full path to the image in your private Bluemix registry in the format `registry.ng.bluemix.net/namespace/image`. " } Memory: { type: "integer" format: "int32" description: "The container memory that is set for the container in Megabyte. Choose one of the following sizes: Pico 64 MB, Nano 128 MB, Micro 256 MB, Tiny 512 MB, Small 1 GB (1024 MB), Medium 2 GB (2048 MB), Large 4 GB (4096 MB) XLarge 8GB (8192 MB) and 2XLarge 16 GB (16384 MB)." } NumberCpus: { type: "integer" format: "int32" description: "Number of virtual CPUs that are allocated to the container." } Volumes: { type: "string" description: "Mount a volume to a container by specifying the details in the following format: `VOLUME_NAME:/DIRECTORY_PATH[:ro]`. Example: testvolume:/volumedata/temp:rw. By default, all volumes will be set up with read-write access inside the container (rw). If you wish to set up your volume with read-only access, enter `ro`. Note: To mount a volume to a container, you must create the volume in your space first by using the `cf ic volume-create` command, or calling the `POST /volumes/create endpoint`." } "X-Auth-Project-Id": { type: "string" } "X-Auth-Token": { type: "string" } name: { type: "string" } } required: ["Image", "X-Auth-Project-Id", "X-Auth-Token"] additionalProperties: false } output: { properties: { Id: { type: "string" description: "Unique ID representing a container." } flavor_id: { type: "integer" description: "The ID of the container size." } mem: { type: "integer" description: "The amount of container memory that has been assigned to the container. If the container memory was not specified in the API request, a container with 64 Megabyte container memory is created by default." } vcpu: { type: "integer" description: "Number of virtual CPUs that are assigned to the container." } } } }