Ben Bagley
Ben Bagley

Reputation: 803

Docker not running Ubuntu 20.04

I've installed docker on a fresh machine and used the following tutorial https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

I have the following output.

~/code » sudo systemctl status docker                                                                               ben@bagley
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-08-10 10:36:50 BST; 3s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 19143 (dockerd)
      Tasks: 20
     Memory: 28.3M
     CGroup: /system.slice/docker.service
             └─19143 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

However, when I run

curl -s "https://laravel.build/example-app?with=mysql,redis" | bash

I get the following: Docker is not running.

Upvotes: 9

Views: 31569

Answers (1)

atline
atline

Reputation: 31674

You use sudo systemctl status docker to confirm docker is running, means you are not in root I guess.

And if you execute curl -s "https://laravel.build/example-app?with=mysql,redis" directly, you could see next:

docker info > /dev/null 2>&1

# Ensure that Docker is running...
if [ $? -ne 0 ]; then
    echo "Docker is not running."

    exit 1
fi
......

Means the curl will download a script, and the log Docker is not running. is print due to not execute docker info correctly when execute that script.

As you are not root, so defintely the docker info could not be run. You have next 3 options to choose to make it work:

Option 1:

sudo usermod -aG docker ${USER} to add current user to docker group, then exit current shell, login the shell again to run the curl command with root.

Option 2:

curl -s "https://laravel.build/example-app?with=mysql,redis" | sudo bash

Option 3:

sudo -s -H to switch to root, then execute the curl command.

Upvotes: 21

Related Questions