如何在Docker容器中安装Docker?

编程入门 行业动态 更新时间:2024-10-21 17:42:54
本文介绍了如何在Docker容器中安装Docker?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我的Dockerfile:

FROM golang #RUN cat / etc / * release 运行apt-get更新运行apt-get -y安装apt-transport-https ca证书curl gnupg2 software-properties-common RUN curl -fsSL download.docker/linux / debian / gpg | apt-key add-运行add-apt-repository deb [arch = amd64] download.docker/linux/debian $ {lsb_release -cs)稳定 运行apt-get更新运行apt-get -y安装docker-ce 运行docker run hello-world

golang Dockerfile是官方的,它基于

Debian GNU / Linux 8(jessie )

所以我通过检查 Docker Install Tutor(Debian)

但是输出是

步骤8/8:运行docker run hello-world --->在b183b8cc5d10 docker中运行:无法以 unix:///var/run/docker.sock连接到Docker守护程序。泊坞窗守护程序正在运行吗? 请参阅 docker run --help。

如何解决此问题?我想在主机docker容器中建立docker容器。图片。要解决这个问题:

  • 首先删除以下行:从您的 Dockerfile
  • 最简单的方法是通过使用 -v 标志绑定安装或安装来公开Docker套接字使用 Docker Compose :
  • docker run的卷-v /var/run/docker.sock:/var/run/docker.sock ...

    This is my Dockerfile:

    FROM golang # RUN cat /etc/*release RUN apt-get update RUN apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common RUN curl -fsSL download.docker/linux/debian/gpg | apt-key add - RUN add-apt-repository "deb [arch=amd64] download.docker/linux/debian $(lsb_release -cs) stable" RUN apt-get update RUN apt-get -y install docker-ce RUN docker run hello-world

    The golang Dockerfile is official, it bases on the

    Debian GNU/Linux 8 (jessie)

    So I wrote down this Dockerfile by checking the install steps from Docker Install Tutor(Debian)

    But the output is

    Step 8/8 : RUN docker run hello-world ---> Running in b183b8cc5d10 docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.

    How to solve this problem? I want to establish docker containers in the host docker container.

    解决方案

    I had a similar problem trying to install Docker inside a Bamboo Server image. To solve this:

  • first remove the line: RUN docker run hello-world from your Dockerfile
  • The simplest way is to just expose the Docker socket, by bind-mounting it with the -v flag or mounting a volume using Docker Compose:
  • docker run -v /var/run/docker.sock:/var/run/docker.sock ...

    更多推荐

    如何在Docker容器中安装Docker?

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

    发布评论

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

    >www.elefans.com

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