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.

  • Docker, varnish, Connection reset by peer
  • I can't seem to get my local shared MySQL data volume to persist on Docker for Windows
  • Docker mongo image 'Connection refused' from other container
  • docker registry fail to start up that prompts file not found which file does exist
  • pytest: environment variable to specify pytest.ini location
  • docker Container command '/hello' not found or does not exist after switching hard drive
  • 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

  • Unable to install windowsServerCore Container Image
  • docker-compose images volumes
  • How to use docker-java API to connect docker?
  • Docker disconnect all containers from docker network
  • Running gunicorn with SSL on localhost? (with docker)
  • How to continue a docker which is exited
  • 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.