mikeizbicki / cmc-csci143

big data course materials
40 stars 76 forks source link

Cannot connect to the Docker daemon #411

Closed Eshaan-Lumba closed 9 months ago

Eshaan-Lumba commented 9 months ago

Hi,

I followed the Docker rootless installation and got the following output:

lambda-server:~ $ curl -fsSL https://get.docker.com/rootless | sh
# Installing stable version 25.0.2
# Executing docker rootless install script, commit: 3b2a83b
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 68.2M  100 68.2M    0     0   131M      0 --:--:-- --:--:-- --:--:--  131M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19.7M  100 19.7M    0     0   171M      0 --:--:-- --:--:-- --:--:--  171M
+ PATH=/home/elaa2020/bin:/home/elaa2020/.local/bin:/home/elaa2020/bin:/home/elaa2020/.local/bin:/home/elaa2020/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin /home/elaa2020/bin/dockerd-rootless-setuptool.sh install
[INFO] systemd not detected, dockerd-rootless.sh needs to be started manually:

PATH=/home/elaa2020/bin:/sbin:/usr/sbin:$PATH dockerd-rootless.sh 

[INFO] Creating CLI context "rootless"
Successfully created context "rootless"
[INFO] Using CLI context "rootless"
Current context is now "rootless"

[INFO] Make sure the following environment variable(s) are set (or add them to ~/.bashrc):
export PATH=/home/elaa2020/bin:$PATH

[INFO] Some applications may require the following environment variable too:
export DOCKER_HOST=unix:///run/user/1358/docker.sock

I added the environment variables to my ~/.bashrc file. Then, when I run $ docker, I get the following output indicating that Docker was successfully installed:

lambda-server:~ $ docker
Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Log in to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information
...

For reference, the following is the output from $ docker version and $ docker info commands:

lambda-server:~ $ docker version
Client:
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:22:06 2024
 OS/Arch:           linux/amd64
 Context:           rootless
Cannot connect to the Docker daemon at unix:///run/user/1358/docker.sock. Is the docker daemon running?
lambda-server:~ $ docker info
Client:
 Version:    25.0.2
 Context:    rootless
 Debug Mode: false

Server:
ERROR: Cannot connect to the Docker daemon at unix:///run/user/1358/docker.sock. Is the docker daemon running?
errors pretty printing info

Problem

When I try following the instructions from lecture, I get the following error:

lambda-server:~ $ docker run -it alpine
docker: Cannot connect to the Docker daemon at unix:///run/user/1358/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

On Thursday, I had been able to follow the commands from lecture and successfully run the docker run -it alpine command. From online research it seems I might need sudo permissions to start the daemon, which I don't have access to. Any suggestions on how to proceed would be really appreciated. I have already tried uninstalling and reinstalling.

Thanks, Eshaan

abizermamnoon commented 9 months ago

try doing this first:

lambda-server:~/bigdata/flask_web $ systemctl --user start docker

This should start the docker.

Eshaan-Lumba commented 9 months ago

I tried that and got the following:

Failed to connect to bus: No such file or directory

from

lambda-server:~ $ systemctl --user start docker
Failed to connect to bus: No such file or directory
lambda-server:~ $ cd bigdata/hw/hw3/flask_web/
lambda-server:~/bigdata/hw/hw3/flask_web $ systemctl --user start docker
Failed to connect to bus: No such file or directory

so there still seems to be something wrong

mikeizbicki commented 9 months ago

These are fantastic questions, and well asked. I've spent the last 30 minutes digging through your account and come to the conclusion that you're fscked.

There are two important services that docker needs called systemd and dbus. Somehow yours got shutdown and I can't get them restarted. I'll need to fix this in person with you.

You can have a +2 day extension on the homework for the inconvenience.