我已经在一台新机器上安装了 docker 并使用了以下教程https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
\n我有以下输出。
\n~/code \xc2\xbb sudo systemctl status docker ben@bagley\n\xe2\x97\x8f docker.service - Docker Application Container Engine\n Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)\n Active: active (running) since Tue 2021-08-10 10:36:50 BST; 3s ago\nTriggeredBy: \xe2\x97\x8f docker.socket\n Docs: https://docs.docker.com\n Main PID: 19143 (dockerd)\n Tasks: 20\n Memory: 28.3M\n CGroup: /system.slice/docker.service\n \xe2\x94\x94\xe2\x94\x8019143 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock\n
Run Code Online (Sandbox Code Playgroud)\n然而,当我跑步时
\ncurl -s "https://laravel.build/example-app?with=mysql,redis" | bash\n
Run Code Online (Sandbox Code Playgroud)\n我得到以下信息:Docker is not running.
atl*_*ine 20
你用来sudo systemctl status docker
确认 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
......
Run Code Online (Sandbox Code Playgroud)
意味着curl会下载一个脚本,并且在执行该脚本时Docker is not running.
由于没有docker info
正确执行而打印日志。
由于您不是root
,所以肯定docker info
无法运行。您可以选择以下 3 个选项来使其发挥作用:
选项1:
sudo usermod -aG docker ${USER}
将当前用户添加到 docker 组,然后退出当前 shell,再次登录 shell 以curl
使用 root 运行命令。
选项2:
curl -s "https://laravel.build/example-app?with=mysql,redis" | sudo bash
选项 3:
sudo -s -H
切换到root,然后执行curl命令。
归档时间: |
|
查看次数: |
24973 次 |
最近记录: |