From cf041568d0aabae08d1c3dd7129508fb2d64a1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 16 Mar 2020 17:39:43 +0100 Subject: [PATCH] Add a big fat warning against "sudo" Also, the permission error that is frequently encountered is added at the top of the list of frequent issues in the docs. --- docs/troubleshooting.rst | 9 +++++++++ tutor/commands/cli.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index d067e05..2ad7d93 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -40,6 +40,15 @@ If you'd rather use a graphical user interface for viewing logs, you are encoura The containerized Nginx needs to listen to ports 80 and 443 on the host. If there is already a webserver, such as Apache or Nginx, running on the host, the nginx container will not be able to start. To solve this issue, check the section on :ref:`how to setup a web proxy `. +"Couldn't connect to docker daemon" +----------------------------------- + +This is not an error with Tutor, but with your Docker installation. This is frequently caused by a permission issue. Before running Tutor, you should be able to run:: + + docker run --rm hello-world + +If the above command does not work, you should fix your Docker installation. Some people will suggest to run Docker as root, or with `sudo`; *do not do this*. Instead, what you should probably do is to add your user to the "docker" group. For more information, check out the `official Docker installation instructions `__. + Help! The Docker containers are eating all my RAM/CPU/CHEESE ------------------------------------------------------------ diff --git a/tutor/commands/cli.py b/tutor/commands/cli.py index 00f6582..1935112 100755 --- a/tutor/commands/cli.py +++ b/tutor/commands/cli.py @@ -1,4 +1,5 @@ #! /usr/bin/env python3 +import os import sys import appdirs @@ -53,6 +54,10 @@ def main(): ) @click.pass_context def cli(context, root): + if os.getuid() == 0: + fmt.echo_alert( + "You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)" + ) context.obj = Context(root)