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:

  • Docker Timezone in Ubuntu 16.04 Image
  • How can i spawn a multiple instances of a container using kubernetes?
  • exit and delete all but the latest docker container
  • Using Docker with nodejs with node-gyp dependencies
  • Docker - Prometheus container dies immediatly
  • Why don't docker use the host OS for all purposes
  • $ 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?

  • docker-py: client and server don't have same version (client : 1.16, server: 1.15)")
  • cannot create JDBC datasource named transactional_DS while implementing Multi-instance in moqui using docker
  • How to remote debug python code in a Docker Container with VS Code
  • Access filesystem from Node app in Docker
  • Managing and Utilizing Multiple Docker Containers (Microservices) in a Single Server
  • how does Flocker implement image migration while doing container migration between hosts
  • 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.