Using Docker Volume Plugins with Amazon ECS-Optimized AMI

If you are wanting to use volume plugins with Docker and are using the Amazon ECS-optimized AMI you will need to make some modification in order to successfully mount external volumes within a container.

By default the init.d script for docker makes mount namespaces unshared in the kernel. Basically mounting and unmounting filesystems will not affect the rest of the system when this is enabled. Volume plugins mount external systems on the container host itself and then automatically associate it to the volume mount target within the container. This is considered sharing which is why we need to fix the init.d script in order to use volume plugins.

Fixing the Docker init.d script

As sudo open the /etc/init.d/docker file in your favorite editor on the ECS container host.

Related

About Jeremy

I'm Jeremy Unruh, a longtime developer, architect, leader and entrepreneur. I love engineering and have a strong passion for cloud computing and service architecture using containers. Welcome to my blog!