Creating shared volume containers in Virtual Labs

Shared volume containers allow you to do what you would expect from the name - expose the volumes of one container for use in another. This is useful for sharing files between applications in different containers, such as Orion or other development environments.

Note: Currently you can only mount the volumes from a single external container. If you need to share more than this, you'll need to include multiple programs within a single docker container, rather than sharing the volumes of another container.

  1. First, ensure that both images you want to use have been pulled into the Images tab of Virtual Labs. If necessary, follow the steps contained within Importing a Virtual Labs image from the container registry or Importing a Virtual Labs image from Docker Hub.

  2. Firstly for the setup, in the image settings for the image we want to share from, we need to set up the shared directory in the image settings.  In the case of this example, that is image-1.  Select the cog icon to edit the image settings, and scroll the window down until you see Volumes to be exposed.  Click on Add volume... and add the path you want to share in the edit box, then save by clicking Update Settings on the bottom of the dialogue.

  3. Next, create an admin container from the first image you want to share volumes from by selecting the Create Container button. Do not select anything in the Mount volumes from dropdown menu, we'll get to this later.

  4. Head over to the Admin Containers tab and click the link to your container in order to work with this admin container to ensure the files you wish to share with the other container are present.

  5. Now create another admin container using the other image. This time, select the name of the container you just created in the Mount volumes from the dropdown.

  6. Ensure this has worked by checking out the Admin container you just created on the Admin Containers tab. The new container should have Volumes from: followed by the ID of the container from which you're sharing the volumes (see above how the ID is listed as the third entry down on the list, 0a0aa0a0aa).

  7. Manipulate your new admin container as you wish in order to ensure you can utilize the volume that has been shared with it. Make sure they are left in the state you want to present to your learners.
  8. Save both containers as new images by clicking the Save as Image button in the Admin Containers tab twice. Make sure you save both containers as images with distinctive names!  (Note: even if you make no changes to the images, you must save the image that mounted volumes, to save the volume mount)

  9. Now go back to the Images tab, and hit the Create Project button.


  10. Select your second image from the Paired Image dropdown and finish off creating the project.

  11. Finally, use your created project to follow the steps outlined in Adding a Virtual Labs project to your Open edX course in order to provide your shared volume containers to your students.

Your project will now launch two containers instead of one! If you have any issues getting this to work, don't hesitate to contact support.