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.

  • rsyslog unable to identify docker container id as hostname from log4j 1x
  • Enable broadcasts between docker containers
  • Docker with Django/PostgreSQL
  • Connecting Docker to X11 via VNC fails
  • Unable to access Jupyter notebook in the web browser
  • Docker-compose: no access to WordPress files
  • 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

  • How do I make a Docker hub use the same image for “latest” and “vX.Y”?
  • How to specify docker image path on command line without editing configuration setting?
  • docker within-container port forwarding
  • Can we run multi-process program in docker?
  • How to connect mysql workbench to running mysql inside docker?
  • How can I find the docker name from a program running inside Docker
  • 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.