• AWS
  • IAAS

So I’ve been doing some testing with Docker and SoftNAS. This brief tutorial will show you how to connect docker to SoftNAS. This will give you a couple of pretty neat options for storage while using Docker.

First a couple of cool things you can do with SoftNAS and Docker:

  • Share persistent storage between Docker containers.
  • Snapshot storage to S3 or elsewhere to save after Docker container has exited.

Before I start, I’m going to assume you have a SoftNAS instance running from the AWS Marketplace. In my case, I used the ephemeral storage to run the storage pool (obviously persistent storage like EBS or S3 should be used for production deployments). The ephemeral storage is free :) There’s also a free micro instance available to DevOps, along with AWS Free Tier support. There are two important parts of setting up this instance in AWS.

  • Make sure you write down the storage share
  • Make sure you pay attention to the security groups. In my testing scenario I allowed all traffic between the two instances. This is not ideal for production at all. But, it allowed me to build in a test scenario quickly.
  • When you create a volume, make sure that you have the “Export NFS Share” check box selected

I used the SoftNAS installation instructions located here.

Once the SoftNAS instance is set up and running, make sure to launch another instance to run Docker on. In my case, I used Ubuntu. Once Ubuntu is up and running, we will want to create a folder to mount the NFS storage from SoftNAS to.

sudo mkdir /softnas

Once the directory is made, I will mount the NFS share from SoftNAS to my Ubuntu instance.


At this point, its good to test that you are connected between both the SoftNAS instance and your Ubuntu instance.

sudo touch /softnas/touch.file

Make sure that the file is written without a problem, then look through the SoftNAS File System to make sure that the file is where it’s supposed to be.

If the share is working, then you should now install docker on your Ubuntu instance. There is a good and quick tutorial here, except don’t bother with the last line. In order to install Docker.io from packages follow this:

sudo apt-get update

sudo apt-get install docker.io

sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker

sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io

source /etc/bash_completion.d/docker.io

You can find a link to the Docker instructions here

It’s easy to test to make sure you have Docker installed correctly by running the following command

docker --version.

Finally, to make sure we can access the NFS SoftNAS share, we are going to run an Ubuntu container, and mount the /softnas directory from our host Ubuntu server to our Docker container.

sudo docker run -i -t --name ubuntu -v /softnas:/softnas ubuntu /bin/bash 

This command will launch a Docker container based on the Ubuntu image. It’s going to name it Ubuntu. It is going to mount the volume /softnas from the local host to the /softnas container file system. Last, it’s going to automatically log us in to a bash command. At that point we can cd to our directory, and test again. Just for reference the -v command is structured host filesystem: container file system.

More on attaching host volumes to Docker containers here.

At this point  you have a running Docker container that can share data across containers, but also across hosts. This data can be snapshot for later use, or any multitude of other things.