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:

  • Pathload from Docker container
  • How do I forward a docker-machine port to my host port on OSX?
  • Docker on Ubuntu 15.10 32 bit (OS and Processor)
  • Why don't docker use the host OS for all purposes
  • Windows Container on Windows 10 Insider Build and Docker for Windows
  • Using a volume with a redmine docker container in Bluemix
  • $ 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?

  • container running but cannot be visited in browser
  • Docker Compose - Not picking up the dump file in the init command?
  • Can not pull docker image
  • Calabash android.util.AndroidException: INSTRUMENTATION_FAILED
  • How can I recreate 'docker run' using the remote API?
  • Docker - failed to connect to running image
  • 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.