Bluemix: service bound to container does not appear in VCAP_SERVICES

I’m trying to use IBM Containers for Bluemix to deploy a container and bind it to a Bluemix service.

I start with an existing Bluemix app, which is bound to the MongoDB service I want. I verify that its VCAP_SERVICES environment variable is correctly populated:

  • How to run docker container from remote api?
  • Write permissions for IBM Containers Volume as non-root user
  • Grouping all the containers on a host: advantages or not?
  • How to add locale in docker container
  • How to persist MySQL container on Windows 10 between reboots
  • create a pure data image in docker
  • $ cf env mamacdon-app
    Getting env variables for app mamacdon-app in org / space dev as
        "VCAP_SERVICES": {
            "mongodb-2.4": [
                    "credentials": { /*private data hidden*/ },
                    "label": "mongodb-2.4",
                    "name": "mongodb-1a",
                    "plan": "100",
                    "tags": [ "nosql", "document", "mongodb" ]

    Then I run my image in Bluemix using the ice command, with the --bind mamacdon-app argument to bind it to my CF app:

    $ ice run --name sshparty \
      --bind mamacdon-app \
      --ssh "$(cat ~/.ssh/" \  # For SSH access
      --publish 22 \                      # For SSH access

    As the name suggests, the image is a trivial example based on the IBM Websphere Liberty docker image — just enough to let me SSH in and poke around.

    At this point, the Containers dashboard tells me that the service has been bound to my container:

    Dashboard showing bound service

    But when I finally ssh into the container, the environment does not contain the VCAP_SERVICES variable:

    $ ssh -i ~/.ssh/id_rsa root@
    root@instance-000123e2:~# env
    SSH_CLIENT=[private data hidden]
    SSH_CONNECTION=[private data hidden]
    LESSOPEN=| /usr/bin/lesspipe %s
    LESSCLOSE=/usr/bin/lesspipe %s %s

    I expected the VCAP_SERVICES variable to be injected. What am I doing wrong?

  • Setting up a PHP decent development environment
  • Docker from debian:wheezy cannot build
  • How do I install RabbitMQ-server on Jessie in Docker?
  • Docker Cloud Automated builds
  • Dockerfile 'RUN git clone' removes intermediate container
  • I tried to set up Kubernetes executor for gitlab but I get ERROR
  • 2 Solutions collect form web for “Bluemix: service bound to container does not appear in VCAP_SERVICES”

    I think there is an issue with the way the ssh daemon is getting launched where it does not have visibility to the VCAP_SERVICES environment variable.

    However, you can confirm that the container’s command will see the variable with following test:

    ice run --bind mamacdon-app --name vcap_services_party printenv; sleep 60

    Then, confirm it in the printenv output with ice logs vcap_services_party

    Could you give the following a try:

    ice run --bind yourappname --name yournewcontainer name

    Once the image comes up run the following.

    # echo $VCAP_SERVICES

    For more info check out the Containers Docs.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.