To quote from StackOverflow: "From docker 17.06, you can mount NFS shares to the container directly when you run it, without the need of extra capabilities."
This can be done like this:
docker run -d --name my-container --rm -p \
--mount "type=volume,target=folder-in-container,volume-nocopy,volume-driver=local,volume-opt=type=nfs,volume-opt=device=my-nfs-server:/path/on/my-nfs-server,"volume-opt=o=addr=nfs_server""
I am aware that this could be done by installing the corresponding nfs-capabilities in the container itself and executing a mount before the actual files are needed. However, this would mean additional unwanted packages in the final container (which are then not needed anymore), i.e. in the case of getting installation files from these volumes.
Happy to clarify if needed.
EDIT
From what it looks ansible-container actually uses docker-compose. Am I right? If so, the following should be possbile:
Extract of container.yml
unfortunately to no avail. It returned ERROR The container.yml file is invalid: '3.2' is not one of ['1', '2'] and the created volume was empty yet again:
Version
0.9.3rc0
ISSUE TYPE
container.yml
SUMMARY
To quote from StackOverflow: "From docker 17.06, you can mount NFS shares to the container directly when you run it, without the need of extra capabilities." This can be done like this:
I am aware that this could be done by installing the corresponding nfs-capabilities in the container itself and executing a mount before the actual files are needed. However, this would mean additional unwanted packages in the final container (which are then not needed anymore), i.e. in the case of getting installation files from these volumes.
Happy to clarify if needed.
EDIT
From what it looks ansible-container actually uses docker-compose. Am I right? If so, the following should be possbile: Extract of container.yml
However running tasks/main.yml:
shows
/mnt
as empty.docker inspect volume nfs-mount
results in:EDIT2
I have tried my setup in docker-compose. Using the following setup it works for docker-compose:
I then adapted my
container.yml
to:unfortunately to no avail. It returned
ERROR The container.yml file is invalid: '3.2' is not one of ['1', '2']
and the created volume was empty yet again: