构建映像时无法运行docker

编程入门 行业动态 更新时间:2024-10-10 23:22:04
本文介绍了构建映像时无法运行docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试在构建映像时使用Docker安装软件,但我得到了。

I tried to install a software with Docker while building an image and I get.

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

我使用的Dockerfile

Dockerfile I used

FROM ubuntu:xenial # Install docker pre-reqs RUN apt-get update -qq && apt-get install -qqy \ apt-transport-https \ ca-certificates \ curl \ lxc \ iptables \ dmsetup \ && apt-get clean && apt-get autoclean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/* ~/.cache # Install Docker from Docker Inc. repositories RUN curl -sSL get.docker/ | sh # Install the Helm package manager by running a docker command RUN docker run --rm --net=host -v /var/lib:/data helm-api:1.0.0 cp /usr/src/app/public/cli/linux-amd64/helm /data CMD ["/bin/bash"]

是否可以在Dockerfile中运行docker命令来创建映像?

Is there a way to run docker commands in a Dockerfile for creating images?

推荐答案

您的问题不在于Docker命令,因为它在错误消息中表示您的Docker守护程序未运行,或者由于某些配置问题而无法连接到它。

your problem is not with the Docker command, as it says in the error message your docker daemon is not running, or because of some configuration problem you can not connect to it.

您刚刚安装了Docker吗?您是否已完成安装指南?

Did you just install Docker? Did you do all the steps in the Installation Guide?

您可以使用 docker run hello-world 或 sudo docker run hello-world

如果仅与sudo兼容,那是因为您未配置docker对于您的用户,请参阅: docs.docker/install/linux / linux-postinstall /

If it only works with sudo it's because you didn't configure docker for your user, see: docs.docker/install/linux/linux-postinstall/

更多推荐

构建映像时无法运行docker

本文发布于:2023-10-27 04:25:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532307.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:映像   docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!