MALOUDA-PSA 2024-06-02 23:18 采纳率: 85.6%
浏览 229
已结题

docker的问题1

docker build -t hello-docker .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

  • 写回答

3条回答 默认 最新

  • 檀越@新空间 2024-06-02 23:18
    关注

    晚上好🌙🌙🌙
    本答案参考ChatGPT-3.5

    问题描述: 在执行docker build -t hello-docker .命令时,出现了如下问题: DEPRECATED: The legacy builder is deprecated and will be removed in a future release.Install the buildx component to build images with BuildKit: https://docs.docker.com/go/buildx/ Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

    问题分析:

    1. 提示第一个警告信息:The legacy builder is deprecated and will be removed in a future release. 表示docker的旧版构建器已被弃用,将在未来的版本中移除。
    2. 提示第二个警告信息:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 表示无法连接到Docker守护程序,也就是Docker daemon。

    解决方案:

    1. 安装 Docker Buildx: 根据提示信息,使用BuildKit来构建镜像,需要安装Docker Buildx组件。可以根据 https://docs.docker.com/go/buildx/ 提供的文档进行安装步骤。
    2. 检查 Docker daemon 是否运行: 由于无法连接到Docker daemon,可能是Docker daemon没有启动。可以通过以下命令检查Docker daemon的运行状态:systemctl status docker(适用于systemd管理的系统)或service docker status(适用于非systemd管理的系统)。如果Docker daemon没有运行,则可以使用以下命令启动它:systemctl start docker(适用于systemd管理的系统)或service docker start(适用于非systemd管理的系统)。

    注意:

    • 如果已经安装了Docker Buildx组件,并且Docker daemon也在运行,但仍然出现问题,请检查是否有其他问题,如权限问题、网络问题等。
    • 可能需要以root或管理员权限执行上述命令。
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 6月16日
  • 已采纳回答 6月8日
  • 创建了问题 6月2日