I am very new to using docker and taking baby steps. I want to mount an NFS mount coming from a NAS system. I have no issues mounting the share on the Linux host where docker or perhaps the container is running.
How can the same share be mounted to the Ubuntu container? I couldn’t find any relevant documentation on this, It would be great if any of you could help me on this.
Also in the NAS system, I must specify the IP address of the host to which the share is exported to and also the Linux user ID and group ID. I can get the ID’s but how to get the IP address of the docker container? When I do a ifconfig I see only a private IP. How to get the IP which identifies the container in public network? So that I can add this host in the NAS system. Is my understanding about IP’s right? or is it not the way it works?
The docker run -v option does this. I wouldn’t try to mount(8) things inside a running container.
In my experience that’s rarely a useful question. In this setup it’s likely that your containers are running on a private subnet like 172.17.0.0/16 that literally doesn’t exist off your host, so from the point of view of the NAS server, it would see your host’s IP address and not anything container-specific.
David, thank you for your response. I never knew about docker volumes, So I took some time to read about it. After my research I came up with the following command,
docker run -d -v ~/network_share:/home/user/Desktop/nfs_share -p 5000:80 -i container_name
When I run this command, what it does is it launches a new container because thats what “docker run” is intended to do. My aim is to provide the share to an existing contatiner. Do you know how this command can be modified for an existing container.
Even in the new container after running the command, the share is not mounted. In the container the command creates directory home/user/Desktop/nfs_share but the network share is not mounted. Thanks again for you time.