我在一台新机器上安装了对接器,并使用了下面的教程https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
我有以下输出。
~/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但是,当我跑的时候
curl -s "https://laravel.build/example-app?with=mysql,redis" | bash我得到以下信息:Docker is not running.
发布于 2021-08-10 12:54:00
您可以使用sudo systemctl status docker来确认码头正在运行,这意味着您不在root中。
如果直接执行curl -s "https://laravel.build/example-app?with=mysql,redis",您可以看到下一步:
docker info > /dev/null 2>&1
# Ensure that Docker is running...
if [ $? -ne 0 ]; then
echo "Docker is not running."
exit 1
fi
......这意味着curl将下载一个脚本,而日志Docker is not running.由于在执行该脚本时没有正确执行docker info而被打印。
由于您不是root,所以肯定无法运行docker info。您可以选择下面三个选项来使其工作:
选项1:
sudo usermod -aG docker ${USER}将当前用户添加到停靠器组中,然后退出当前shell,再次登录shell以使用root运行curl命令。
备选方案2:
curl -s "https://laravel.build/example-app?with=mysql,redis" | sudo bash
选项3:
sudo -s -H切换到root,然后执行curl命令。
https://stackoverflow.com/questions/68724464
复制相似问题