最近在Ubuntu上搭建vulhub環境時在運行:
ubuntu@ubuntu:docker-compose up -d
報錯:
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
在網上找了很多教程找解決方式,效果都不是很好,不過運氣還不差有一個方法解決了這個問題:
1、將當前用戶加入docker組
ubuntu@ubuntu:sudo gpasswd -a ${USER} docker
2、重啟docker服務
ubuntu@ubuntu:sudo systemctl restart docker
3、切換會話
ubuntu@ubuntu:newgrp - docker
提示:本文並非原創,因為找了很多方法浪費了很多時間才解決的問題所以將原作者的文章做一個推廣,給大家提供一個好的解決方法,如果原作者不同意請聯系刪除。
原文連接:https://www.cnblogs.com/360minitao/p/12179629.html