1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker on Ubuntu18.04 on WSL2 と VSCode インストール手順

Last updated at Posted at 2020-10-06

Windows-10.0.19041 WSL-2 ![Ubuntu-18.04 LTS](https://img.shields.io/badge/Ubuntu-18.04 LTS-brightgreen) docker-19.03.13 ![Visual Studio Code-1.49.3](https://img.shields.io/badge/Visual Studio Code-1.49.3-brightgreen)
Windowsをクリーンインストールしまして、
よい機会なので VSCode with Docker on Ubuntu on WSL without Docker Desktop on Windows のインストール手順を覚書きしておきます
これが幸せかどうかは知らんけど

目指す姿

Extensions - VSCode
Docker - VSCode

wsl2をインストール

一次情報

  1. PowerShell管理者

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

```powershell
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  1. Windows再起動

  2. PowerShell管理者

wsl --set-default-version 2


## Ubuntu 18.04 LTS をインストール
1. [Microsoft Store](https://www.microsoft.com/store/apps/9N9TNGVNDL3Q) から入手とインストールと起動

## Docker をインストール
1. Install using the repository
  * [一次情報](https://docs.docker.com/engine/install/ubuntu/)

    ```bash
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. Post-installation steps for Linux

sudo groupadd docker

```bash
sudo usermod -aG docker $USER
newgrp docker
  1. Configuring remote access with daemon.json

sudo vi /etc/docker/daemon.json

```vim:/etc/docker/daemon.json
{
"hosts": ["unix:///var/run/docker.sock", "tcp://127.0.0.1:2375"]
}
sudo service docker restart

確認

$ docker --version
Docker version 19.03.13, build 4484c46d9d
$ sudo netstat -lntp | grep dockerd
tcp        0      0 127.0.0.1:2375          0.0.0.0:*               LISTEN      3973/dockerd

Visual Studio Code をインストール

以上

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?