openstack-discuss Digest, Vol 50, Issue 62
Kerem Çeliker
celiker.kerem at icloud.com
Tue Dec 27 18:32:19 UTC 2022
Hello Vincent,
To allow a user from a container to access files on OpenStack, you can use the --volume or -v option when creating the container to mount a host file or directory as a volume inside the container. For example:
Copy code
docker run -it --volume /path/on/host:/path/in/container image_name
This will mount the host file or directory located at /path/on/host as a volume inside the container at /path/in/container. The user inside the container will be able to access the files in the volume at /path/in/container.
You can also use the --mount option to mount a volume. This option provides more control over the volume, such as specifying the volume driver and options. For example:
Copy code
docker run -it --mount type=bind,source=/path/on/host,target=/path/in/container image_name
This will also mount the host file or directory located at /path/on/host as a volume inside the container at /path/in/container, and the user inside the container will be able to access the files in the volume at /path/in/container.
Note that the /path/on/host must be an absolute path and must exist on the host system. The /path/in/container can be any path inside the container and does not need to exist prior to the mount.
It's also important to note that the user inside the container must have the appropriate permissions to access the mounted files. You can use the --user option to specify the user that the container should run as, or you can set the ownership and permissions of the mounted files on the host system to allow the user inside the container to access them.
Hope it works for you..
—
Best, Regards,
Kerem Çeliker
IBM | Red Hat Champion
keremceliker.medium.com
Sent from my iPhone
> On 27 Dec 2022, at 15:07, openstack-discuss-request at lists.openstack.org wrote:
> Send openstack-discuss mailing list submissions to
> openstack-discuss at lists.openstack.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss
>
> or, via email, send a message with subject or body 'help' to
> openstack-discuss-request at lists.openstack.org
>
> You can reach the person managing the list at
> openstack-discuss-owner at lists.openstack.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of openstack-discuss digest..."
>
>
> Today's Topics:
>
> 1. Container access mounted device (vincent lee)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 27 Dec 2022 19:01:21 +0800
> From: vincent lee <vincentlee676 at gmail.com>
> To: openstack-discuss at lists.openstack.org
> Subject: Container access mounted device
> Message-ID:
>
>
> Hi, I have deployed a working OpenStack and would like to know if there are
> any possible options I can enable so that when creating a new container,
> files can be mounted to it, and a user from the container can access it.
> For instance, having a mounted device from the compute host and allowing
> the /dev/(mounted device name) file to be accessible in the container.
>
> Best regards,
> Vincent
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20221227/ed48f47c/attachment-0001.htm>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> openstack-discuss mailing list
> openstack-discuss at lists.openstack.org
>
>
> ------------------------------
>
> End of openstack-discuss Digest, Vol 50, Issue 62
> *************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20221227/f818f77a/attachment-0001.htm>
More information about the openstack-discuss
mailing list