gpt4 book ai didi

docker - 创建挂载源路径时出错 mkdir/host_mnt/d : file exists

转载 作者:行者123 更新时间:2023-12-02 18:03:45 41 4
gpt4 key购买 nike

我运行 docker-compose up -d
报错

D:\project\c\test\docker>docker-compose up -d
Starting debug ... error

ERROR: for debug Cannot start service gdbserver: error while creating mount source path '/host_mnt/d/project/c/test/docker': mkdir /host_mnt/d: file exists

ERROR: for gdbserver Cannot start service gdbserver: error while creating mount source path '/host_mnt/d/project/c/test/docker': mkdir /host_mnt/d: file exists
ERROR: Encountered errors while bringing up the project.

Dockerfile
FROM ubuntu:cosmic

########################################################
# Essential packages for remote debugging and login in
########################################################

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
apt-utils gcc g++ openssh-server cmake build-essential gdb gdbserver rsync vim

RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

# 22 for ssh server. 7777 for gdb server.
EXPOSE 22 7777

RUN useradd -ms /bin/bash debugger
RUN echo 'debugger:pwd' | chpasswd

########################################################
# Add custom packages and development environment here
########################################################

########################################################

CMD ["/usr/sbin/sshd", "-D"]

docker-compose.yaml
# From: https://github.com/shuhaoliu/docker-clion-dev/blob/master/docker-compose.yml

version: '3'

services:
gdbserver:
build:
context: ./
dockerfile: ./Dockerfile
image: clion_dev
security_opt:
- seccomp:unconfined
container_name: debug
ports:
- "7776:22"
- "7777:7777"
volumes:
- .:/home/debugger/code
working_dir: /home/debugger/code
hostname: debug

最佳答案

我也遇到了这个问题(使用 Docker Desktop for Windows)。对我来说,我只是通过以下步骤重新启动了 Docker:

  • 找到 Docker 桌面图标(在 Windows 任务栏中)
  • 右键单击 Docker 桌面图标并选择“重新启动...”
  • 在出现的确认对话框中单击“重新启动”按钮

  • 当 Docker Desktop 重新启动后,我:
  • 使用 docker-compose ps
  • 检查正在运行的容器
  • 使用 docker-compose down
  • 停止任何正在运行的容器
  • 启动容器 docker-compose up

  • 瞧!所有容器都成功重启,没有安装错误。

    关于docker - 创建挂载源路径时出错 mkdir/host_mnt/d : file exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59526444/

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