Docker for Mac Beta: Unable to link containers properly

I have tried linking two containers and executing commands valid on one from the other which works in the docker toolbox version of the tool.

Copy of YML file:

  • Docker-compose cannot start mysql, permission denied to /tmp
  • kafka-node LeaderNotAvailable errors on send
  • Reverse proxy nginx and Express server returning 502
  • Docker Compose JVM parameters
  • Could not save file in the docker image after “docker commit”
  • How to set docker run arguments on marathon spec
  • version: '2'
         image: nginx:latest
         hostname: nginx
         - php
         - "8000:80"
       privileged: true
       image: php:5-fpm
       hostname: php
       privileged: true

    I expect to be able to log onto the nginx container and be able to execute php i.e. php -version.

    docker exec -it test2_nginx_1 bash
    root@nginx:/# ping php
    PING php ( 56 data bytes
    64 bytes from icmp_seq=0 ttl=64 time=0.103 ms
    64 bytes from icmp_seq=1 ttl=64 time=0.089 ms

    Ping works!

    root@nginx:/# php -version
    bash: php: command not found

    This does not work.

    Logging on to the php container:

    docker exec -it test2_php_1 bash
    root@php:/var/www/html# php -version
    PHP 5.6.22 (cli) (built: Jun  8 2016 17:49:08)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

    Why am I not able to execute it on the linked container?

  • docker registry v2 upload fails for some images
  • Play Framework - Passing Application Arguments via Docker Container
  • docker cp from host to container is not working
  • Why is this docker image allowed past the firewall?
  • AWS EC2 Docker Volumes lsblk
  • How to change nginx config in amazon elastic beanstalk running a docker instance
  • One Solution collect form web for “Docker for Mac Beta: Unable to link containers properly”

    Why am I not able to execute it on the linked container?

    Because “linking” (or, since docker 1.10, a common network), is about communication, not programs.

    Your nginx container is like an individual machine on which php was never installed. It can ping the php container, but not locally execute what is installed only on said php machine.

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