January 17, 2016

Volumes allow vessels to have access to directories that are not part of it’s original filesystem. This is made possible through filesystem mounting.

Spacedecode allows you to achieve this by updating the vessel configuration file (vessel.yml). The volume specification requires two settings:

  • source: The path to the directory on the host machine.
  • destination: The path under which the directory above should reflect.

NB: Changes made to the vessel configuration file only reflect when the vessel starts up. So, after making the necessary updates on a running vessel’s configuration file, restart it for the changes to take effect.


Say you are building a website using the Nginx recipe. You will notice that if you succeed, it will give you a default Nginx page (may look different):

Nginx default page

But your website is about something else right? And you have something way more interesting to show right?

If so there are two ways of achieving this:

Inside the vessel

You can put your files inside the vessel under /usr/share/nginx/html. You can do this using the Spacedecode commandline simulator.

Outside the vessel

You can also have your files residing outside the vessel, but mounted inside it. Say your files are located on the project directory (just one level up from the vessel directory) in a directory called website (for example). Website files on the project directory

To mount that directory inside the vessel (webserver.vsl), edit vessel.yml (found inside the webserver.vsl directory). Add the following lines at the bottom:

- source: ../website
  destination: /usr/share/nginx/html

Restart the vessel and when you look at the output on the browser, you should see whatever the contents of ../website/index.html are.

NB: If the directory ../website did not exist, Spacedecode will create it and copy the contents of the destination folder into it. In the case of the example above, this would cause you to see the same Nginx sample page until the contents of the directory are changed.

Again, that was just an example.

comments powered by Disqus