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

How to disable web page styles using Firefox's web developer

Prerequisite: The web developer plugin has been in...

Tips for creating two-dimensional arrays in JavaScript

Creation of a two-dimensional array in Js: First ...

Thoroughly understand JavaScript prototype and prototype chain

Table of contents Preface Laying the foundation p...

Detailed explanation of custom instructions for Vue.js source code analysis

Preface In addition to the default built-in direc...

Tutorial on installing MySQL 5.7.9 using RPM package under CentOS 7

Recorded MySQL 5.7.9 installation tutorial, share...

Vue3 Documentation Quick Start

Table of contents 1. Setup 1. The first parameter...

Interpretation of syslogd and syslog.conf files under Linux

1: Introduction to syslog.conf For different type...

Mysql join query syntax and examples

Connection query: It is the result of connecting ...

Three ways to implement waterfall flow layout

Preface When I was browsing Xianyu today, I notic...

Implementation of Nginx configuration of local image server

Table of contents 1. Introduction to Nginx 2. Ima...

MySQL 8.0.20 winx64 installation and configuration method graphic tutorial

This article shares with you the installation and...

What is flex and a detailed tutorial on flex layout syntax

Flex Layout Flex is the abbreviation of Flexible ...

50 Super Handy Tools for Web Designers

Being a web designer is not easy. Not only do you...