<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Docker daemon permissions to access NFS share - Home Lab Forum				            </title>
            <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/</link>
            <description>Virtualization Howto Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 11 Aug 2026 02:18:52 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1116</link>
                        <pubDate>Tue, 14 Jan 2025 03:39:57 +0000</pubDate>
                        <description><![CDATA[@wuruwhi Thank you for keeping things posted on progress. This is actually what I do with my Ceph storage I am using. I create the directory prior and then create the bind mount path needed ...]]></description>
                        <content:encoded><![CDATA[<p>@wuruwhi Thank you for keeping things posted on progress. This is actually what I do with my Ceph storage I am using. I create the directory prior and then create the bind mount path needed for mounting the directories to the folders in Ceph. So this behavior I am familiar with. I would actually like to get to the bottom of this myself as well but haven't chased this down as of yet. I have a suspicion that Docker changes permissions perhaps on the first go around that allows the creation of the directory when it attempts the 2nd time.</p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1116</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1115</link>
                        <pubDate>Tue, 14 Jan 2025 03:29:20 +0000</pubDate>
                        <description><![CDATA[Hey,
So I did some more playing around over the week-end. I started with a clean minimized install of Ubuntu Server and went on to install the necessary components and setting up fstab for ...]]></description>
                        <content:encoded><![CDATA[<p>Hey,</p>
<p>So I did some more playing around over the week-end. I started with a clean minimized install of Ubuntu Server and went on to install the necessary components and setting up fstab for the NFS share and bindfs option as well. </p>
<p>It mounted properly and creating files or directory showed that it worked as expected.<br />I deployed a couple containers and mapped them to the bindfs directory and it deployed and ran as it should. However after a restart of the host, the bind wouldn’t mount anymore. It threw an error saying the directories weren’t empty.<br />I found that weird.</p>
<p>So I tried the other avenue (which so far still works) of mounting the NFS share in fstab and then in the compose files, modifying the volumes to the mount point location.<br />The only downside, is that I have to manually create the directories before deploying a container.<br />Deploying directly fails for directory creation permissions, however, rerunning compose up creates the directories the second time around. Even though I did not adjust anything.</p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Wuruwhi</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1115</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1094</link>
                        <pubDate>Mon, 06 Jan 2025 05:03:34 +0000</pubDate>
                        <description><![CDATA[It certainly does. &#x1f642; 
I will try this out during the week if I can.]]></description>
                        <content:encoded><![CDATA[<p>It certainly does. &#x1f642; </p>
<p>I will try this out during the week if I can. </p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Wuruwhi</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1094</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1093</link>
                        <pubDate>Sat, 04 Jan 2025 04:14:55 +0000</pubDate>
                        <description><![CDATA[@wuruwhi Great question! To clarify, the Docker daemon does not need to run under the same user that owns the NFS directory. Here&#039;s how it will work:
The Docker daemon runs as root user or ...]]></description>
                        <content:encoded><![CDATA[<p>@wuruwhi Great question! To clarify, the Docker daemon does not need to run under the same user that owns the NFS directory. Here's how it will work:</p>
<p>The Docker daemon runs as root user or another user like "docker". This user needs to have permissions to access and manage the data root directory or any bind-mounted directories. But, it does not need to match the uid/gid of the user owning the NFS share.</p>
<p>Your mount of the volume (NFS client) will receive access based on what permissions it has been configured with on the server side.</p>
<p>If the NFS share is mounted with the right user the uid/gid and permissions, your Docker containers and the daemon will be able to access it as expected.</p>
<p>So for instance:</p>
<pre contenteditable="false">sudo mount -t nfs -o rw,uid=1234,gid=1234 nfs-server:/share /mnt/nfs</pre>
<p>Then you mount the storage as a bind mount in your container:</p>
<pre contenteditable="false">docker run -v /mnt/nfs/specific-dir:/app/data my-container</pre>
<p>Hopefully this helps &#x1f600;  </p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1093</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1092</link>
                        <pubDate>Sat, 04 Jan 2025 03:46:29 +0000</pubDate>
                        <description><![CDATA[@brandon-lee Great to hear that! &#x1f642;Does the Docker daemon has to run with the same uid as the one owning the share?]]></description>
                        <content:encoded><![CDATA[@brandon-lee Great to hear that! &#x1f642;<br /><br />Does the Docker daemon has to run with the same uid as the one owning the share?]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Wuruwhi</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1092</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1091</link>
                        <pubDate>Sat, 04 Jan 2025 03:37:52 +0000</pubDate>
                        <description><![CDATA[@wuruwhi Awesome! Yeah i would probably go the route of the second option as it keeps Docker with what the defaults are for most things and that way you can pick and choose what you want to ...]]></description>
                        <content:encoded><![CDATA[@wuruwhi Awesome! Yeah i would probably go the route of the second option as it keeps Docker with what the defaults are for most things and that way you can pick and choose what you want to store on your NFS storage. So far I have not had any issues with my data for critical containers using this approach. I have had to restore files a few times and it has worked as expected &#x1f44d;]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1091</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1090</link>
                        <pubDate>Sat, 04 Jan 2025 03:25:19 +0000</pubDate>
                        <description><![CDATA[Hey Brandon,
Really appreciate the two suggestions. &#x1f642; 
For the first part: Yes, both systems are Linux based.I’ll check for the root_squash setting. I wasn’t aware of this. 
Permi...]]></description>
                        <content:encoded><![CDATA[<p>Hey Brandon,</p>
<p>Really appreciate the two suggestions. &#x1f642; </p>
<p>For the first part: Yes, both systems are Linux based.<br />I’ll check for the root_squash setting. I wasn’t aware of this. </p>
<p>Permission wise, both mount point and share on each systems were owned by the same uid and gid. Also for some reason, it seemed to check for the name of the user rather than the uid, because once I set on the NAS root as the owner of the share, docker seemed to be happier. But I reverted back as I did not wanted root owning the share.</p>
<p>I had try to find the daemon to give it the proper uid, but did not realize it could be done by modifying docker.service. Still learning Docker, I used to run everything directly on dedicated VMs.</p>
<p>However, I like your second suggestion better as it’s way easier indeed, and it will do what I wanted, which is to have the data on the NAS and not on the VMs directly.</p>
<p>I’ll reset the Docker VM to start clean and will just map the share and bind mount it to containers. <br />Going that route, does the docker daemon still need to have the same uid as the one owning the share?</p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Wuruwhi</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/paged/2/#post-1090</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1089</link>
                        <pubDate>Fri, 03 Jan 2025 15:01:41 +0000</pubDate>
                        <description><![CDATA[Also, just a simpler approach to think about. When i am using external storage like NFS, or any other, you don&#039;t have to change all your docker storage to use the external storage, but simpl...]]></description>
                        <content:encoded><![CDATA[<p>Also, just a simpler approach to think about. When i am using external storage like NFS, or any other, you don't have to change all your docker storage to use the external storage, but simply bind mount your containers that you want to have stored on your external storage bind mounted to that specific directory. This will simplify your challenges with trying to change the entire Docker data root to be your NFS share. </p>
<p>So, for example:</p>
<pre contenteditable="false">version: "3.8"

services:
  app:
    image: nginx:latest
    container_name: container-I-want-on-nfs-storage
    ports:
      - "8080:80"
    volumes:
      - /mnt/nfs_share:/usr/share/nginx/html:rw
    restart: always
</pre>
<p>The bind mount will make sure the data for your container is stored on NFS while the data-root for docker itself remains the default. This way you can protect your data that you want for those specific containers and not change Docker's data root.</p>
<p> </p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1089</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1088</link>
                        <pubDate>Fri, 03 Jan 2025 14:57:45 +0000</pubDate>
                        <description><![CDATA[Ok, so a few thoughts here. Docker needs full control of the data-root directory. So it might need to perform operations that are conflicting with your NFS permissions or the user-level perm...]]></description>
                        <content:encoded><![CDATA[<p>Ok, so a few thoughts here. <br /><br />Docker needs full control of the data-root directory. So it might need to perform operations that are conflicting with your NFS permissions or the user-level permissions.<br /><br />Make sure root_squash is not enabled for your NFS export. If it is, change it to no_root_squash temporarily to test if this resolves the issue:<br /><br />/MyNFS/MountPoint 192.168.x.x(rw,sync,no_root_squash), then restart the NFS server after making your changes. Is this running on a Linux server? If so, you can do something like sudo exportfs -ra<br />after making your changes. <br /><br />On the NFS server, make sure your directory /MyNFS/MountPoint/docker is owned by uid=1234 and</p>
<p>gid=1234.<br />Run the following commands on the NFS server:<br /><br /></p>
<pre contenteditable="false">sudo chown -R 1234:1234 /MyNFS/MountPoint/docker
sudo chmod -R 775 /MyNFS/MountPoint/docker</pre>
<p><br /><br />Also, make sure your share is mounted with the right options for Docker. Edit your /etc/fstab or mount command to use the following:<br /><br /></p>
<pre contenteditable="false">nfs defaults,rw,sync 0 0</pre>
<p><br /><br />Make sure your Docker daemon runs with the same user uid=1234. You can do this by modifying your docker.service file to include the directive:<br /><br /></p>
<pre contenteditable="false">
user=1234</pre>
<p><br /><br />The last error that you posted there looks like there is conflicting docker configurations. You will want to use either systemd configuration file or the daemon.json file but not both. If you are using systemd configuration, make sure no data-root directive is in your daemon.json file. If you are using the daemon.json file, remove the --data-root flag from your systemd service file if that makes sense.<br /><br />Once you have made your changes, try to restart the docker service:<br /><br /></p>
<pre contenteditable="false">sudo systemctl daemon-reload
sudo systemctl restart docker</pre>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1088</guid>
                    </item>
				                    <item>
                        <title>RE: Docker daemon permissions to access NFS share</title>
                        <link>https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1087</link>
                        <pubDate>Fri, 03 Jan 2025 04:58:39 +0000</pubDate>
                        <description><![CDATA[@wuruwhi welcome to the forums! Glad to have you here and hopefully we can work through the NFS issue with Docker. Let me take a look at the information in the posts you have made and I will...]]></description>
                        <content:encoded><![CDATA[<p>@wuruwhi welcome to the forums! Glad to have you here and hopefully we can work through the NFS issue with Docker. Let me take a look at the information in the posts you have made and I will get back to you with my thoughts if that sounds good and some troubleshooting steps &#x1f44d; </p>]]></content:encoded>
						                            <category domain="https://www.virtualizationhowto.com/community/home-lab-forum/">Home Lab Forum</category>                        <dc:creator>Brandon Lee</dc:creator>
                        <guid isPermaLink="true">https://www.virtualizationhowto.com/community/home-lab-forum/docker-daemon-permissions-to-access-nfs-share/#post-1087</guid>
                    </item>
							        </channel>
        </rss>
		