mycontainer is unprivileged, then its owner might not have access to the path
/pool/mydataset. Users in unprivileged containers have their uid offset on the host by the container-owner uid, so
user1 inside the container isn't the same as
user1 on the host.
You can check what user on the host owns the container with
sudo ls -l /pool/lxc | grep mycontainer (
sudo might not be required, depending on
/pool/lxc's permissions, but
ls should be safe enough to run as root either way. Going forward, omit
sudo where desirable if permissions make that possible). For example, I get
drwxr-xr-x 4 100000 100000 5 Apr 22 11:37 mycontainer
showing that the uid and gid of the container's owner is 100000 (we see a uid instead of a name since the user doesn't exist on the host).
/pool/mydataset's permissions with
sudo ls -l /pool | grep mydataset (or
sudo ls -l /pool/mydataset for its contents).
If you want the files to be writable from within the container, you just have to make sure whichever user inside
mycontainer you want to be able to write to
/pool/mydataset has permissions to do so on the host. E.g.,
mycontainer has uid 100000 on host, and if
mycontainer has uid 1001 (test with
id user1 from within the container) then on the host its uid would be 101001.
You might do that by allowing everyone on the host to write to
sudo chmod -R o+w /pool/mydataset
(note: this will add permissions recursively inside
/pool/mydataset), or perhaps better to make sure users in group
user1 have write permissions (set it recursively with
sudo chmod -R g+w /pool/mydataset if not), then add the owner of the container to group
sudo usermod -a -G user1 <username>
(In my case above, we saw that no user on the host owns the container, so we should first create a user with uid and gid 100000 with
adduser --no-create-home --uid 100000 --disabled-password --disabled-login <username>
Of course, you might wish to give permissions only to
user1 inside the container, so create a user with its host uid and add that to group
user1 on host, e.g., 101001.)
You can also go nuclear and give ownership of
mycontainer's root with
sudo chown -R 100000:100000 /pool/mydataset
but that could mess with other users on host accessing the data.
Once you've done that, the mount you set should allow write permissions inside
mycontaier, as desired.