win under docker environment configuration

statement

  • This article only for win7, win10 Home Edition operating system and other users, these systems can not be used because the windows Hyper-V virtualization technology. Docker to use only the help of Virtual Box virtual machine.

Docker configuration

Docker Toolbox installation

  • After confirming that you can only use Virtual Box mounted docker, you need to download Docker Toolbox, installation refer to the official documentation . Or you can download the latest release Toolbox Docker .
  • Installation Docker Toolbox, will help you to install three software - Docker Quikstart, Oracle VM VirtualBox, Kitematic. That means you do not have to deliberately to install one of them.

Docker Toolbox start

  • After installation, you can open Docker Quikstart, it will help you start Virtual Box and other related software. Sometimes, you may encounter an error, you can try uninstalling VirtualBox, Kitematic reinstall it again Docker Toolbox.

docker client

  • After Quikstart open Docker is a command-line tool, also docker clients can operate docker services through some commands.
  • image.png

Configure shared directory

  • Although Docker Quikstart can by /d/paththe path of the directory, but when you start container, directory mapping may appear abnormal , into the container found in the file directory mapping none of the normal map.
  • VirtualBox is a default shared directory - /c/Users/.
  • image.png
  • If the directories and files when you start the container to be mapped are located in this directory, you basically do not have to make any adjustments. If you put your code file (that is, start docker container to map the directory / file) on the other disk, such as drive d, but it is not shared directory VirtualBox configuration, in which case you need to manually configure it shared directory.
  • image.png
  • Can add a shared directory, but fill in the configuration directory names Note:
  • image.png
  • After a good new shared directory, you need to restart, run the command to Docker Quikstart docker-machine restart defaultto complete restart. Docker will be able to use the relevant command again later.
  • The previous code directory is configured /d/docker/work_codeso that when we start the directory mapping when the vessel can write:docker run -it -v /d/docker/work_code/project1:/opt/wwwroot/project1 docker_php /bin/bash
  • In other words, we are by the absolute path /d/docker/work_code/project1to map host directory of the way.
  • This time into the container to view the mapping directory is normal, code files are also present.
  • Subsequent use docker docker use as ordinary as can be.

access

  • When the docker configuration is complete, start the container, we can be accessed through a browser or verify the client as a postman. Using VirtualBox way than through the docker container 127.0.0.1but to be accessed by visiting the virtual machine ip accessed. Therefore, in Docker Quikstart by docker-machine ipto see your ip virtual machine on the machine. Then start to access the service by way of ip + port number.
$ docker-machine.exe ip
192.168.99.100

Epilogue

  • Through the above settings, the main reason is a problem shared directory is not set right. So long as the configuration according to the above "is set shared directory", it can be used normally.

Guess you like

Origin www.cnblogs.com/ishenghuo/p/11547053.html