Docker-compose Run Error: Couldn’t connect to Docker daemon at http+docker://localhost – is it running?

The reason for this problem is the problem of user rights. There are two solutions

Switch to the root user to execute the commandsudo docker-compose up -d

Adds the current user to the docker group sudo gpasswd - a ${user} docker and then switch to root user, then switch to current user, and execute docker compose up - d again, there is no problem

➜  /usr/local/tidb-docker-compose git:(master) sudo gpasswd -a penelope docker
You are adding the user "penelope" to the "docker" group
➜ /usr/local/tidb-docker-compose git:(master) su - 
Password:
[email protected]:~# su - penelope
➜  /home/penelope cd /usr/local/tidb-docker-compose 
➜  /usr/local/tidb-docker-compose git:(master) docker-compose up -d
Creating network "tidb-docker-compose_default" with the default driver
Creating tidb-docker-compose_prometheus_1_c5dcdc31242f          ... done
Creating tidb-docker-compose_pd0_1_76eba4089930                 ... done
Creating tidb-docker-compose_dashboard-installer_1_aacf66ea2abb ... done
Creating tidb-docker-compose_pd1_1_37f2e3342d08                 ... done
Creating tidb-docker-compose_pushgateway_1_6bdd0daf84ee         ... done
Creating tidb-docker-compose_pd2_1_8f3958f98cb1                 ... done
Creating tidb-docker-compose_grafana_1_b1171d4ef96c             ... done
Creating tidb-docker-compose_tidb-vision_1_1cfffb488802         ... done
Creating tidb-docker-compose_tikv2_1_e8dda83dee83               ... done
Creating tidb-docker-compose_tikv0_1_df5a641d13f5               ... done
Creating tidb-docker-compose_tikv1_1_7d2d291b11a7               ... done
Creating tidb-docker-compose_tispark-master_1_6d1132a4e105      ... done
Creating tidb-docker-compose_tidb_1_8c9570604565                ... done
Creating tidb-docker-compose_tispark-slave0_1_722ac312ba0e      ... done

Similar Posts: