Solution to the failure of docker windows10 shared directory mounting

Solution to the failure of docker windows10 shared directory mounting

cause

When executing the docker script, an error occurs that the container cannot be created.

As shown below:

Cannot create container for service xxx: b'Drive has not been shared'

I went to Stack Overflow and found that the solution was to go to Setting->Shared Drives, and then check the disk address that I wanted to use for Docker to mount the image.

However, no matter how you check, Rest credentials, Apply, or even Reset, factory reset will not help. Every time I enter the user password, Docker automatically clears my options.

There are several reasons you need to analyze:

1. In the Local Security Policy, in Local Policies->Security Options->Network Access: Sharing and security model for local accounts, the security settings do not release permissions, and you need to select classic mode here.

2. Is it a firewall problem? Port 445 is not used for mapping.

3. Is Hyper-V disabled?

The main problem here is that the drive has not been shared due to the first situation. After setting it up, go to Setting->Shared Drives->the disk you want to mount, reset it, and run it.

Supplement: When using run -v in win10 docker, the virtual machine cannot display the directory mounted by the host

I have been learning Docker these days. The problem I encountered today is this:

docker run --name centos7 -it -v D:\docker-data\exchange\:/mnt centos:7

Using the above method to start a container, the files under D:\docker-data\exchange\ cannot be loaded in the /mnt directory of the virtual machine. However, when I started the container, it started normally without reporting any errors. It took a while. But yesterday I used this method and was able to mount normally and read the host machine's files normally.

Later I found out that I had changed my computer password yesterday, and I had to re-verify it before I could read it normally. (I don't know if it's a pitfall of Docker. The previously verified password has been changed, but executing the above command does not require re-authentication and does not report an error. What a pitfall)

Use the following method to clear the verification first, open the docker settings window, click reset credentials on the following page, then check the disk where the directory to be mounted is located, and re-enter the password (I don’t know why the password is required here. I have never set a password on my computer, but I set one specifically for using docker)

Then you can successfully mount the directory to the virtual machine.

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Solve the problem that the directory mounted by docker cannot be read and written
  • Docker View the Mount Directory Operation of the Container
  • Solve the problem of failure to mount files or directories using ./ relative path in docker run
  • Implementation of mounting NFS shared directory in Docker container
  • Docker - Summary of 3 ways to modify container mount directories
  • Docker mounts local directories and data volume container operations
  • Docker starts the elasticsearch image and solves the error after mounting the directory

<<:  Detailed explanation of MySQL Group by optimization

>>:  Solution to the problem of English letters not wrapping in Firefox

Recommend

Chrome plugin (extension) development guide (complete demo)

Table of contents Written in front Preface What i...

WeChat applet selects the image control

This article example shares the specific code for...

Detailed explanation of Vue life cycle functions

Table of contents Lifecycle Functions Common life...

Summary of basic SQL statements in MySQL database

This article uses examples to describe the basic ...

Detailed explanation of how to upgrade software package versions under Linux

In the Linux environment, you want to check wheth...

Manually implement js SMS verification code input box

Preface This article records a common SMS verific...

MySQL statement execution order and writing order example analysis

The complete syntax of the select statement is: S...

Docker deploys mysql remote connection to solve 2003 problems

Connecting to MySQL Here I use navicat to connect...

MySQL encryption and decryption examples

MySQL encryption and decryption examples Data enc...

MySQL 8.0.20 compressed version installation tutorial with pictures and text

1. MySQL download address; http://ftp.ntu.edu.tw/...

Common usage of hook in react

Table of contents 1. What is a hook? 2. Why does ...

How to install Graphviz and get started tutorial under Windows

Download and installConfigure environment variabl...

Detailed explanation of html download function

The new project has basically come to an end. It ...