gpt4 book ai didi

docker - 设置远程Docker服务器时出错

转载 作者:行者123 更新时间:2023-12-02 21:30:04 25 4
gpt4 key购买 nike

在我的Pi上,我跟随this tutorial在raspbian上安装docker。这里的一些旁注:

  • 我没有设置群集,我在docker info处停了下来,并且(如在其他指南中一样)我成功运行了hello world容器。
  • idk如果重要的话,但本指南(与其他指南不同)让我编辑/etc/apt/sources.list并添加以下行:deb https://download.docker.com/linux/raspbian/ stretch stable

  • 在我的开发机器上(10号胜利),我使用 this tutorial将docker config和ymls添加到了我的mern堆栈应用中。但是,在本教程的多个地方,他们希望我运行docker命令,所以最终我不得不安装Docker Desktop。
    但是我不想使用本地容器,我想在Pi上使用远程容器。因此,我使用 this tutorial尝试设置了我的远程 docker 。
    但是我得到一个错误:

    C:\Users\oweng>docker-machine create --driver generic--generic-ip-address=192.168.1.2 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-hostRunning pre-create checks... Creating machine... (remote-docker-host)Importing SSH key... Waiting for machine to be running, this may takea few minutes... Detecting operating system of created instance...Waiting for SSH to be available... Enter passphrase for key'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa':Enter passphrase for key'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa':Detecting the provisioner... Enter passphrase for key'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa':Error creating machine: Error detecting OS: OS type not recognized


    我用谷歌搜索了一下错误,但是没有找到解决方法。
    此外,当检查我的Pi(docker服务器)上的监听端口时,我看不到它正在运行

    pi@raspberrypi:~ $ sudo lsof -i -P -n | grep LISTEN xrdp-sesm 390root 7u IPv6 14566 0t0 TCP [::1]:3350 (LISTEN) sshd
    404 root 3u IPv4 17224 0t0 TCP *:22 (LISTEN) sshd
    404 root 4u IPv6 17226 0t0 TCP *:22 (LISTEN) xrdp
    406 xrdp 11u IPv6 17302 0t0 TCP *:3389 (LISTEN)


    所以我觉得服务器可能没有运行?但这似乎是。

    pi@raspberrypi:~ $ systemctl status docker ● docker.service - DockerApplication Container Engine Loaded: loaded(/lib/systemd/system/docker.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2020-11-03 07:18:21 PST; 3h 35minagoDocs: https://docs.docker.com Main PID: 496 (dockerd)Tasks: 13 CGroup: /system.slice/docker.service└─496 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

    Nov 03 07:18:14 raspberrypi dockerd[496]:time="2020-11-03T07:18:14.064113743-08:00" level=warning msg="Yourkernel does not support cgroup blkio throttle.w Nov 03 07:18:14raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064249212-08:00"level=warning msg="Your kernel does not support cgroup blkiothrottle.r Nov 03 07:18:14 raspberrypi dockerd[496]:time="2020-11-03T07:18:14.064373483-08:00" level=warning msg="Yourkernel does not support cgroup blkio throttle.w Nov 03 07:18:14raspberrypi dockerd[496]: time="2020-11-03T07:18:14.066367493-08:00"level=info msg="Loading containers: start." Nov 03 07:18:17raspberrypi dockerd[496]: time="2020-11-03T07:18:17.612685200-08:00"level=info msg="Default bridge (docker0) is assigned with an IPaddress Nov 03 07:18:18 raspberrypi dockerd[496]:time="2020-11-03T07:18:18.710629367-08:00" level=info msg="Loadingcontainers: done." Nov 03 07:18:20 raspberrypi dockerd[496]:time="2020-11-03T07:18:20.815943637-08:00" level=info msg="Dockerdaemon" commit=4484c46 graphdriver(s)=overlay2 v Nov 03 07:18:20raspberrypi dockerd[496]: time="2020-11-03T07:18:20.822947178-08:00"level=info msg="Daemon has completed initialization" Nov 03 07:18:21raspberrypi systemd1: Started Docker Application Container Engine.Nov 03 07:18:21 raspberrypi dockerd[496]:time="2020-11-03T07:18:21.273201136-08:00" level=info msg="API listenon /var/run/docker.sock"


    更新1
    this SO之后,我似乎能够使服务器运行。编辑docker.service文件。我现在在尝试创建时遇到了另一个错误

    C:\Users\oweng>docker-machine create --driver generic--generic-ip-address=192.168.1.2:2137 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-hostRunning pre-create checks... Creating machine... (remote-docker-host)Importing SSH key... Waiting for machine to be running, this may takea few minutes... Error creating machine: Error waiting for machine tobe running: Maximum number of retries (60) exceeded


    更新2
    BMitch的评论将我引向了这两个教程,这似乎正是我想做的
    https://code.visualstudio.com/docs/containers/ssh
    https://code.visualstudio.com/docs/containers/choosing-dev-environment#_remote-machine

    最佳答案

    我不会为此使用docker-machine。对该工具的支持似乎正在消失,并且有许多更简单的方法。
    最简单的方法是将计算机上的DOCKER_HOST设置为远程节点的ssh设置:

    export DOCKER_HOST=ssh://user@host
    docker info # should now show the remote host if you have ssh access
    如果您发现自己在节点之间进行了大量更改,建议您设置一个上下文,然后将DOCKER_HOST保持未设置状态:
    unset DOCKER_HOST
    docker context create rpi --description "Pi" --docker "host=ssh://user@host"
    docker --context rpi info
    然后,您可以通过以下方式使上下文成为新的默认值:
    docker context use rpi
    然后切换回本地/默认docker引擎
    docker context use default

    关于docker - 设置远程Docker服务器时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64665688/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com