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.

  • How to delete unused blobs in docker registry?
  • Accessing CLI apps from one docker container in another container
  • How to find Docker REST API URI for Jenkins
  • Mongodb on samba shared directory
  • Docker-machine host env on multiple computers?
  • Jenkins Docker container not copying pre-installed plugins to JENKINS_HOME on start
  • Docker Disable legacy registry using osx
  • How to access host DB from Docker container?
  • Docker - can you over-allocate ram (tomcat)?
  • How to make docker fail or check version exists
  • What's are the benefits for using Data Volume Container as a single-database “backend” in Docker?
  • Unable to create machine in docker
  • 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.