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 for Mac. docker run -d -p 80:80 --name webserver nginx shows another container with this name. but docker ps shows empty list
  • How do I use EBS volume with ECS container
  • Use data of docker container inside another
  • Cannot create docker images
  • Load kernel module from mac os sierra host to a docker container
  • Invalid value while trying to create a kubernetes pod with secret in it
  • $ 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?

  • How to create a multi container web application in docker
  • Bash - seamlessly run scripts with CRLF line endings
  • How to implement custom health checks for EC2 instances without using an ELB?
  • Limit Disk usage in Docker+MongoDB
  • AWS ECS container with tomcat + jdk
  • How to properly setup a data volume container?
  • 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.