久々のwindows

Powershell7

インストール

GitHub - PowerShell/PowerShell: PowerShell for every system!

リリースからダウンロードしてインストール

keybindをlinuxっぽく

PSReadLine は最初から入ってたっぽいので↓実行する

Set-PSReadLineOption -EditMode Emacs

ってやってて気づいたけどこれだと永続化しないので, $PROFILEに書く。

新しいPowerShellで$PROFILEの場所が変わってたので作り直しておく

New-Item -Name (Get-Item $PROFILE).Directory -Type dir
New-Item -path $PROFILE -ItemType file
vim $PROFILE
cat $PROFILE
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Emacs

Windows Terminal

とりあえず入れた

WSL2

WSL2対応版のDocker Desktopで必要だったのでUbuntu 18.04 入れた

WSL 2 のインストール | Microsoft Docs

この手順通りでいけたけど、

wsl --set-version <Distro> 2

をやらないと変換されないのに、

wsl --set-default-version 2

こっちをずっと打ってて変換されなくて頭抱えてた

Docker for Desktop

Docker Desktop for WSL2 を使い快適にWindowsでサーバ開発をしよう! - Qiita

これみてやった。(けど、後述だけど↑これはもう古かった。変なところからインストールしたせいでおかしな物が入ってた)

インストールは普通にできたが

PS C:\Users\totem> docker run hello-world
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: error during connect: Post https://192.168.99.100:2376/v1.40/containers/create: dial tcp 192.168.99.100:2376: connectex: A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Windows側からはつながらない.

WSL2側では動いてる。そりゃそうだけど。

totem@xxx:/home/totem$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

defaultのほう見てたっぽい。とはいえこっちも起動してるはずなんだけどなぁ

PS C:\Users\totem> docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHE
STRATOR
default *           Current DOCKER_HOST based configuration   tcp://192.168.99.100:2376                           swarm
wsl                 Docker daemon hosted in WSL 2             npipe:////./pipe/docker_wsl
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --conte
xt flag, or unset DOCKER_HOST environment variable.

f:id:totem_3:20200321165109p:plain
起動しているはず、の図

とまぁ色々悩んでたんだけど、これなんか古いバージョン入れてたせいでおかしくなってた。docker context の wsl ってのはもう使わないっぽい(?)

あと、古いdocker toolboxみたいなの入れてたから変に環境変数が設定されてて動かなかった。

最新のdocker desktopにアップデートして、環境変数消したら問題なくなった。

Visual Studio 2019

2017入ってたけど入れ直した。何が違うのか知らんけど。

クリップボード

前から使えたはずだけど知らなかったので windows + V で clipboard history 有効にしてclibor サヨナラ