Skip to content

Instantly share code, notes, and snippets.

@ujiro99
Last active August 21, 2017 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ujiro99/b1b26deb760f55b0fee6e52679c65a05 to your computer and use it in GitHub Desktop.
Save ujiro99/b1b26deb760f55b0fee6e52679c65a05 to your computer and use it in GitHub Desktop.
PyCharmでDocker(Hyper-V)を使う on Windows 10(2017/8時点) ref: http://qiita.com/ujiro99@github/items/7d916f9cb9078225987b
# /var/lib/boot2docker/に格納するとdocker-machine起動時に実行される
ip addr add 172.29.32.2/20 dev eth0 # HostOSと同じサブネット内で固定IPアドレスを設定する
uid=1000 # dockerユーザ
gid=50 # staffグループ
user=share # HostOSで共有を許可したユーザ名
password=xxxxxxxxxxxx # 共有を許可したユーザのパスワード
host_ip=//172.29.32.1 # HostOSのIPアドレス
mkdir -p /home/docker/src
mount -t cifs -o uid=${uid},gid=${gid},username=${user},password=${password} ${host_ip}/src /home/docker/src
$ docker-machine create --driver hyperv --hyperv-memory 4096 --hyperv-cpu-count 4 default
$ wget http://distro.ibiblio.org/tinycorelinux/5.x/x86/tcz/cifs-utils.tcz
$ tce-load -i cifs-utils.tcz
> ipconfig
Windows IP 構成
イーサネット アダプター vEthernet (HNS Internal NIC) 2:
接続固有の DNS サフィックス . . . . .:
リンクローカル IPv6 アドレス. . . . .: fe80::68fe:336d:b69b:e392%24
IPv4 アドレス . . . . . . . . . . . .: 172.29.32.1 ★これをHostOSのIPアドレスとして使う
サブネット マスク . . . . . . . . . .: 255.255.240.0 ★サブネットにはこれ
デフォルト ゲートウェイ . . . . . . .:
・・・省略
ip addr add 172.29.32.2/20 dev eth0 # HostOSと同じサブネット内で固定IPアドレスを設定する
$ docker-machine env default
You can further specify your shell with either 'cmd' or 'powershell' with the --shell flag.
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://172.29.32.2:2376
SET DOCKER_CERT_PATH=C:\Users\uj\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
> docker pull python:3.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment