Is it possible to allow the containers running on the same image to share their filesystem?

I am going to explain the question with an example. Suppose that we are running two seperate processes on the same image. One of them creates a file and continues to execute. I need the other process running in a different container to see, inspect, change this file.

Thanks in advance.

  • Connect rails app in Docker container to external Postgresql Database via URL
  • How to install ffmpeg for ubuntu using command line?
  • How to use command in docker-compose.yml
  • Where should environment-specific values be saved in a Laravel 5 application?
  • How to set up a simple docker-contained reverse-proxying (nginx) server?
  • If a service is started during docker build, should it be running at runtime?
  • Why containers network throughput is low
  • Why does oracle connection opens so slow on mac os sierra?
  • Docker Compose Wordpress example
  • How to make a call to Rest-Endpoint which are deployed on Linux machine as a Docker Container
  • Ubuntu based docker-machine image
  • Obtain ID of just-built image
  • 2 Solutions collect form web for “Is it possible to allow the containers running on the same image to share their filesystem?”

    You can use the volumes. The idea is for the container A to create a volume mounted in a specific directory, to perform all operation that are needed to be shared there and for the container B to mount the volume from the container A.

    1) ID=$(docker run -d -v /tmp base /bin/sh -c 'echo hello > /tmp/world')

    2) docker run -volumes-from $ID base cat /tmp/world

    Notice that there is no commit. Both container use the same image.

    Mounting host directories into a container is now possible with the new Bind Mounts feature (currently in master and set to be released shortly with 0.5.0).

    Usage is as follows:

    docker run -t -i -v /host:/container base bash

    This will ensure that the host’s /host directory is mounted to the container’s /container directory, with read-write access.

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