1. If Windows 10 uses Vmware

Problem: VMware and Docker are incompatible. The solutions are as follows:

1.1 If you want to use VM:

bcdedit /set hypervisorlaunchtype off
Copy the code

Restart the PC before using the VM

1.2 If you want to use Docker:

bcdedit /set hypervisorlaunchtype auto
Copy the code

Restart the PC before using Docker

2. After using Docker for several days

Problem: Suddenly one day the following error occurs:

error during connect: This error may indicate that the docker daemon is not running.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/build? buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Do ckerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=setting&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified.Copy the code

Solutions are as follows:

cd "C:\Program Files\Docker\Docker"

Copy the code

3. Use of environment variables

3.1 Run in docker

Based on the ubiquity of containers, you can think of containers as lightweight operating systems. If docker runs the application, the environment variables are written in the Dockerfile as follows:

The FROM McR.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR/app EXPOSE 80 EXPOSE 443 # in Windows and macOS platform not docker0 virtual network adapter, ENV DB_HOST="host.docker. Internal "ENV DB_PASSWORD="aaaaaaa" ENV DB_NAME="test" ENV DB_USER="root" ENV DB_PORT="3306"Copy the code

3.2 Local Running

Win10 – “advanced system Settings -” environment variables – “system variables, as follows:

[OK] button, and then restart the computer