LESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/typography.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/template.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/responsive.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/k2.less

Follow Me Icons

 

Follow @KendrickColeman on TwitterConnect on LinkedInWatch My Videos on YouTubeFollow me on FacebookCheck Out My Projects on GitHubStay Up To Date with RSS

Search

BSA 728x90 Center Banner

How to Use Volume Drivers and Storage with New Docker Service Command

Docker 1.12 brought a few exciting features, notably swarm mode. However, this new swarm mode brought a new docker command for your containers. Gone is the days of using docker run or docker ps for managing your containers. The new command uses docker service. This makes sense as our applications are turning into individual services the need some level of availability that Swarm now manages. But with it comes some subtle changes in regards to using volumes, volume-drivers, and storage (SAN, NAS, DAS).

 

Using the typical docker run command, we would utilize volume drivers through the --volume-driver flag. 

docker run -d --volume-driver=rexray -v mypgdata:/var/lib/postgresql/data postgres

 

 This is pretty easy to read and you know what it's doing. Specifying the volume-driver and then the host mount mapped to the container mount. You can also specify multiple volumes and only have to use the volume-driver flag once

docker run -d --volume-driver=rexray -v mypgdata:/var/lib/postgresql/data -v pgetc:/etc postgres

 

The new docker service commands brings a few new intricacies so how does this look?

docker service create --replicas 1 --name pg --mount type=volume,source=mypgdata,target=/var/lib/postgresql/data,volume-driver=rexray postgres

 

With this command we are specifying the --mount flag and using the type, source, target, and volume-driver subcommands to mimic the initial docker run command. In addition, we want to run a single instance using the --replicas flag. The nature of the docker service command means it will restart containers on a different host if the docker daemon is unreachable. Small plug here for my EMC {code} group, but REX-Ray is one of the only available volume drivers that has High Availability built-in so the process of forcefully unmounting a volume from a host so it can be mounted elsewhere is done. Lastly, --replicas just makes sure there is always 1 instance of it running because we don't want to have multiple containers trying to have read/write access to the volume. However, you can create a secondary service that has read-only access and runs on the same host as the pg service to read from the mypgdata mount using constraints.

 

The new docker service also brings in the capability to utilize multiple volume-drivers for different mounts. This is handy if a particular container needs access to multiple volumes on different storage endpoints. With REX-Ray, you can utilize modules to have multiple storage endpoints with their own distinct and unique sock and then use the service command such as:

docker service create --replicas 1 --name pg --mount type=volume,source=mypgdata,target=/var/lib/postgresql/data,volume-driver=scaleio --mount type=volume,source=pglogs,target=/var/logs,volume-driver=isilon postgres

 

At this point you should be pretty versed on how to use volumes with docker service. Don't forget to checkout docker service ls and docker service ps to know how your containers are getting scheduled. Keep watching Docker Service Create for more updated documentation.

 

Original Photo can be found at: https://medium.com/@katopz/hello-docker-swarm-with-swarmkit-e6cfdd91a379#.l060chjr9

Related Items

Related Tags

LESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/blue.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/green.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/orange.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/purple.less