How to run docker-compose under WSL 2

Томица Кораћ picture Томица Кораћ · Mar 18, 2020 · Viewed 11.8k times · Source

According to Docker documentation, using Docker under WSL v2 should be fairly simple:

  1. Install WSL 2 (make sure all the preconditions are met);
  2. Install Docker Desktop 2.2.0 or newer;
  3. In Docker Settings > General enable 'Expose daemon on tcp://localhost:2375 without TLS' and 'Enable the experimental WSL 2 based engine';
  4. Make sure no Docker-related packages are installed in your Linux file system.

Once all this is done, I should be able to run docker or docker-compose commands from my Linux Terminal. But I'm not. I keep getting Command 'docker' not found, but can be installed with sudo apt install docker.io'.

What am I doing wrong?

Answer

Виктор Тат picture Виктор Тат · Jun 11, 2020
  1. Install docker and docker-compose.
  2. Type in the terminal:

    sudo service docker start
    sudo service --status-all | grep '+'