- Checking whether shared mounts are enabled
- CoreOS Configuration and Shared Mounts
- RedHat/CentOS Configuration and Shared Mounts
- Ubuntu Configuration and Shared Mounts
- Amazon Linux Configuration and Shared Mounts
- Verify that shared mounts work
Portworx requires Docker to allow shared mounts.
Checking whether shared mounts are enabled
If the following command succeeds, shared mounts are enabled on your system and no action is needed.
$ docker run -it -v /mnt:/mnt:shared busybox sh -c /bin/date
If the command fails with below error, you need to enable shared mounts using this guide.
$ docker run -it -v /mnt:/mnt:shared busybox sh -c /bin/date
docker: Error response from daemon: linux mounts: Path /mnt is mounted on / but it is not a shared mount..
The following sections describe how to configure Docker for shared mounts on CoreOS, RedHat/CentOS, and Ubuntu. The configuration is required because the Portworx solution exports mount points.
CoreOS Configuration and Shared Mounts
- Verify that your Docker version is 1.10 or later:
$ docker -v
- Copy the docker.service file for editing:
$ sudo cp /usr/lib64/systemd/system/docker.service /etc/systemd/system
- Edit the docker service file for
systemd
:$ sudo vi /etc/systemd/system/docker.service
Remove the
MountFlags
line.- Reload the daemon:
$ sudo systemctl daemon-reload
- Restart Docker:
$ sudo systemctl restart docker
RedHat/CentOS Configuration and Shared Mounts
Follow the Docker installation guide for Red Hat Enterprise Linux/Centos and then start the Docker service.
- Verify that your Docker version is 1.10 or later:
$ docker -v
- Edit the service file for
systemd
:$ sudo vi /lib/systemd/system/docker.service
Remove the
MountFlags
line.- Reload the daemon:
$ sudo systemctl daemon-reload
- Restart Docker:
$ sudo systemctl restart docker
Ubuntu Configuration and Shared Mounts
- SSH into your first server.
Follow the Docker installation guide for Ubuntu:
- Verify that your Docker version is 1.10 or later. In your SSH window, run:
$ docker -v
- In your SSH window, run:
$ sudo mount --make-shared /
If you are using
systemd
, remove theMountFlags=slave
line in your docker.service file.The Ubuntu in this example is not using
systemd
.
Amazon Linux Configuration and Shared Mounts
NOTE that Amazon Linux EC2 images do not have the systemd(1)
service, so the installation instructions are somewhat different:
- Using Amazon EC2, start your Amazon Linux instance (
Amazon Linux AMI 2016.09.1, ami-f173cc91
), and SSH into it. - Install docker package:
$ sudo yum install docker
- Verify that your Docker version is 1.10 or later. In your SSH window, run:
$ docker -v
- In your SSH window, run:
$ sudo mount --make-shared /
- Add the
--propagation shared
flags to the docker startup script:$ sudo sed -i.bak -e \ 's:^\(\ \+\)"$unshare" -m -- nohup:\1"$unshare" -m --propagation shared -- nohup:' \ /etc/init.d/docker
- Restart docker service:
$ sudo service docker restart
Verify that shared mounts work
Head back to Checking whether shared mounts are enabled to check that shared mounts are now working.