Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while creating mount source path mkdir /host_mnt/d: file exists

i run docker-compose up -d report error

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
like image 760
王奕然 Avatar asked Dec 30 '19 06:12

王奕然


People also ask

How to restart Docker containers with no Mount errors?

And Voila! All containers restarted successfully with no mount errors. Show activity on this post. Right click on Docker on Window icon > Setting > Share driver > Reset credentials ... .

Why can't root see the directory mounted by gocryptfs?

By default event root can't see the directory mounted by gocryptfs, only the user who executed the gocryptfs command can. To fix this add user_allow_other to /etc/fuse.conf and use the -allow_other flag e.g. gocryptfs -allow_other encrypted mnt

How do I mount an encrypted directory in cryfs?

Then mount the encrypted directory with the command cryfs <secretdir> <opendir> -o allow_root (where <secretdir> and <opendir> are the encrypted directory and the FUSE mount point for the decrypted virtual directory, respectively). Credits to the author of this comment on GitHub for calling my attention to the -o allow_root option.

Where is the source directory in the IDE?

The IDE automatically creates a directory under C:\Users\MyName\sourceepo Rename source and repo to Source and Repo solved the problem. Sorry, something went wrong.


Video Answer


2 Answers

I also experienced this issue (using Docker Desktop for Windows). For me, I simply issued a restart for Docker by using the following steps:

  1. Locate the Docker Desktop Icon (in the Windows Task Bar)
  2. Right-Click the Docker Desktop Icon and choose "Restart..."
  3. Click the "Restart" button on the confirmation dialog that appears

When Docker Desktop had restarted, I then:

  1. Checked for running containers using docker-compose ps
  2. Stopped any running containers using docker-compose down
  3. Started the containers docker-compose up

And Voila! All containers restarted successfully with no mount errors.

like image 172
Matt Woodward Avatar answered Oct 16 '22 17:10

Matt Woodward


Right click on Docker on Window icon > Setting > Share driver > Reset credentials ... . For me that fix the problems.

image

like image 44
lamth Avatar answered Oct 16 '22 18:10

lamth