Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount a local directory in docker toolbox

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to mount the local directory in docker toolbox, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

Preparation condition

Create a new vm_share folder in the root directory of the e disk, and create several new test files under that file, such as:

Mount directory form one

After starting Docker quickstart Terminal, go to the interface shown in the figure. If you execute the mount command at this time, you can only mount the directory of the current user of disk c. Mounting other disks will not take effect and will not report an error. For example, execute the following command

Docker run-it-- name busybox1-v / e/vm_share:/opt busybox sh

After entering the container, look in the / opt directory and you can see that the files are not shared.

If you want to mount to another drive letter in this form, you can establish a soft connection to the shared directory we specified by establishing a soft connection under the current user's directory of disk c.

Mklink "c:/Users/ user name / vm_share"e:/vm_share"

And then through the command

Docker run-it-- name busybox1-v c:/Users/ user name / vm_share:/opt busybox sh

At this point, you can access the files in the specified directory

Mode two

Open Oracle VM VirtualBox in the start menu bar

Select shared folder, select add, select the folder we need to share, and check automatic mount and fixed allocation. After saving, use the command in cmd or Docker quickstart Terminal.

Docker-machine restart

Restart the docker machine, and after the restart is complete, use the command

Docker-machine ssh default

Go to the docker machine and the shared directory is in the / directory. Then execute the mount command at this time.

Docker run-it-- name busybox5-v / vm_share:/opt busybox sh

You can also see the files under the shared folder at this time.

Thank you for reading this article carefully. I hope the article "how to mount a local directory in docker toolbox" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report