create windows Hyper-V docker-machine image for use with cifs to mount C: drive
precondition: docker for windows and tools are prepared. example installation with scoop:
scoop install sudo
scoop install docker
confirm this command:
C:\home> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
create iso file with fixed IP and cifs def
cd <creating iso dir>
docker run --env CIFS_USR=dockercifs --env CIFS_PSW=egRL8gTsVts2JPgh --env CIFS_DMN=BRE-PC18-10007 --env IP_ADDR=192.168.199.11/24 --env IP_NW=192.168.199.0/24 --env IP_GW=192.168.199.254 --rm korabo/boot2docker-cifs:latest > boot2docker.cifs.iso
http:https://www.vwnet.jp/windows/WS12R2/Hyper-V/Hyper-V_Network.htm https://www.slideshare.net/SMurashima/hyperv-137904259
New-VMSwitch -SwitchName "HV-NAT-192168199000" -SwitchType Internal
$NIC = Get-NetAdapter | ? Name -eq "vEthernet (HV-NAT-192168199000)"
$IfIndex = $NIC.IfIndex
New-NetIPAddress -IPAddress 192.168.199.254 -PrefixLength 24 -InterfaceIndex $IfIndex
New-NetNat -Name "192.168.199.0/24" -InternalIPInterfaceAddressPrefix 192.168.199.0/24
to use file share
Get-NetConnectionProfile
Name : 識別されていないネットワーク
InterfaceAlias : vEthernet (HV-NAT-192168199000)
InterfaceIndex : 13
NetworkCategory : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic
use "InterfaceIndex : 13"
Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private
create user on local-machine(BRE-PC18-10007) username: dockercifs password: egRL8gTsVts2JPgh
share: C:\ as C
cd <created.iso dir>
sudo docker-machine create --driver hyperv --hyperv-virtual-switch HV-NAT-192168199000 --hyperv-cpu-count 2 --hyperv-boot2docker-url boot2docker.cifs.iso default
change memory e.g.) 1G -> 1.5G
initialize in vm, exec script for initialization
sudo bash /opt/prepare.bash
- failed to acccess to server on created docker container. check dnsserver lines in /etc/resolv.conf