Docker: Alias command name to run another sibling docker container

I know how to -v the docker socket into a container to make the host’s docker daemon available inside a container. Fine.

I have a dockerized application A that can operate on files on the host.

  • Elastic Beanstalk Multicontainer Docker Environments: redirect requests between 2 APIs
  • How to watch xvfb session that's inside a docker on remote server from my local browser?
  • Docker & Rails | bundler: command not found: rails
  • Docker difference in start and stop times
  • Does windows 7 supports docker daemon?
  • Airbnb Airflow using all system resources
  • I have another dockerized application B that wants to use that application A to operate on files on the host, but is hardcoded to call /usr/bin/A filename.

    How do I alias /usr/bin/A within container B, so that it will call out to the other container, like

    docker run -ti --rm A filename

  • Cassandra container with --net=host exits immediately
  • How do I run yesod init from a docker container?
  • What is the difference between save and export in Docker?
  • Rancher CLI random host port mapping
  • How to install a non-distro package inside Docker without wasting space?
  • Referencing services with Docker Compose
  • One Solution collect form web for “Docker: Alias command name to run another sibling docker container”

    You could just replace /usr/bin/A in container B with a shell script:

    #!/bin/sh
    docker run -ti --rm A "$@"
    

    You could do this in the image itself (via your Dockerfile), or you could bin-mount the script when you start container B (docker run -v /path/to/my/script:/usr/bin/A ...).

    Now you run /usr/bin/A some_filename and it should do the right thing, assuming that you can successfully run docker inside the container.

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