When I run docker I wish to be able to access and write to the NFS filesystem.
The following is a brief technique:
Inside the dockerfile:
RUN useradd -m -d /home/mydocker mydocker; echo 'usermod -u $HOST_UID mydocker' >> ~/.bash_profile
# what order does this run in?
ENTRYPOINT source /root/.bash_profile && su - mydocker && /bin/bash
If I we to run docker with:
[me@mydev]$ sudo docker -i run -e"HOST_UID=`id -u`" -v /some/nfs/drive:/var/local/drive -t
Then mydocker will have the same uid as the user I ran the sudo with and should be able to access the NFS drive in the same was as the native user (me).
No comments:
Post a Comment