Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matthewhartman/235ff1a6b86a6ff7645aa50f4526e27a to your computer and use it in GitHub Desktop.
Save matthewhartman/235ff1a6b86a6ff7645aa50f4526e27a to your computer and use it in GitHub Desktop.

Revisions

  1. matthewhartman created this gist Aug 6, 2020.
    62 changes: 62 additions & 0 deletions running-docker-on-ubuntu-windows-subsystem.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    # Running Docker on Ubuntu WSL

    Configure Docker for Windows (Docker Desktop)

    ![Windows Docker Settings](https://nickjanetakis.com/assets/blog/docker-for-windows-expose-daemon-without-tls-5118c5ffd844dd8dbb9e6b2935c108035bd0fc6b06565774db3aed18f138acc3.jpg "Windows Docker Settings")

    ## Install Docker in Ubuntu WSL

    Update the apt package list
    ```bash
    sudo apt-get update -y
    ```

    Install Docker's package dependencies
    ```bash
    sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
    ```

    Download and add Docker's official public PGP key.
    ```bash
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    ```

    Verify the fingerprint.
    ```bash
    sudo apt-key fingerprint 0EBFCD88
    ```

    Add the `stable` channel's Docker upstream repository.
    ```bash
    sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"
    ```

    Update the apt package list (for the new apt repo)
    ```bash
    sudo apt-get update -y
    ```

    Install the latest version of Docker CE.
    ```bash
    sudo apt-get install -y docker-ce
    ```

    Allow your user to access the Docker CLI without needing root access.
    ```bash
    sudo usermod -aG docker $USER
    ```

    ## Configure WSL to Connect to Docker for Windows

    ```bash
    echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
    ```

    source: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly