miroslavpejic85 / mirotalk

🚀 WebRTC - P2P - Simple, Secure, Fast Real-Time Video Conferences Up to 4k and 60fps, compatible with all browsers and platforms.
https://p2p.mirotalk.com
GNU Affero General Public License v3.0
2.64k stars 513 forks source link

"Not a directory" error mounting .env folder in docker #173

Closed balajigunasekaran closed 9 months ago

balajigunasekaran commented 9 months ago

Running the install.sh in ubuntu for docker is throwing errors (am using wsl for windows for ubuntu environment)

Getting an error related when trying to mount .env folder to src/.env folder

  1. Run sudo ./install.sh
  2. Choose Y when asked Use docker (y/n)?
  3. Choose N when asked Use official docker image (y/n)?
  4. Error as below
  5. Error occured because there is a .dot in target folder name src/.env The issue is in the target folder name "src/.env" It works fine if target folder is src/env,

Starting mirotalk ... error

_ERROR: for mirotalk  Cannot start service mirotalk: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env" to rootfs at "/src/.env": mount /mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env:/src/.env (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Logs are copied below

2023-08-13 11:02:20 :: Copy .env.template to .env (edit it according to your needs)
Use docker (y/n)? y
2023-08-13 11:02:24 :: Install Docker and Docker Compose
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
docker.io is already the newest version (20.10.25-0ubuntu1~22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
docker-compose is already the newest version (1.29.2-1).
0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.
2023-08-13 11:02:25 :: Add the current user to the docker group
Use official docker image (y/n)? n
2023-08-13 11:02:27 :: Build image from source
Building mirotalk
Sending build context to Docker daemon  20.72MB
Step 1/10 : FROM node:18-alpine
 ---> 50c7e33a9de1
Step 2/10 : WORKDIR /src
 ---> Using cache
 ---> d5fcb9eed71a
Step 3/10 : RUN apk add --no-cache      bash    vim
 ---> Using cache
 ---> 0a54a72c225e
Step 4/10 : COPY package.json .
 ---> Using cache
 ---> 37c29bf2f79e
Step 5/10 : COPY .env.template ./.env
 ---> Using cache
 ---> 12fd7dd7654e
Step 6/10 : RUN     npm install &&     npm cache clean --force &&     npm update &&     rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /usr/share/doc/*
 ---> Using cache
 ---> d41d152e84e9
Step 7/10 : COPY app app
 ---> Using cache
 ---> fb712b6e3f13
Step 8/10 : COPY public public
 ---> Using cache
 ---> a0cc4f31a6e0
Step 9/10 : EXPOSE 3000/tcp
 ---> Using cache
 ---> 65aceeecd50a
Step 10/10 : CMD npm start
 ---> Using cache
 ---> 701fc3ef046a
Successfully built 701fc3ef046a
Successfully tagged mirotalk/p2p:latest
2023-08-13 11:02:29 :: Remove old and unused docker images

2023-08-13 11:02:29 :: Start containers
Starting mirotalk ... error

ERROR: for mirotalk  Cannot start service mirotalk: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env" to rootfs at "/src/.env": mount /mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env:/src/.env (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for mirotalk  Cannot start service mirotalk: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env" to rootfs at "/src/.env": mount /mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env:/src/.env (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project._
miroslavpejic85 commented 9 months ago

Hello @balajigunasekaran,

It looks like the issue is stemming from the Docker container trying to mount a file onto a directory or vice versa, which is causing the error. Here are some steps you can take to resolve the issue:

  1. Update Folder Structure: Since you've identified that the issue might be related to the folder name with a dot (.), you can modify the install.sh script to ensure that the target folder name is something like src/env instead of src/.env. This should help avoid any confusion with Docker's volume mounting.

  2. Check .env Path: Ensure that the .env file is present in the expected location (/mnt/c/Users/JamesTaylor/source/publicrepos/mirotalk/.env) and that the path is correctly specified in the script. Double-check the file name and extension.

  3. Check Docker Compose Configuration: If your script is using Docker Compose to manage containers, check the docker-compose.yml configuration file for any inconsistencies in the volume mounting paths. Make sure that the source path is pointing to the correct .env file and the target path within the container is a directory.

  4. Permissions: Make sure that the .env file and its parent directories have the necessary permissions to be accessed by Docker. You might need to adjust the permissions using the chmod command.

  5. Use Absolute Paths: Instead of relying on relative paths, use absolute paths for both the source and target locations. This can help avoid any ambiguity in the paths, especially when using WSL.

  6. Docker Configuration: Check your Docker configuration within WSL. It might help to restart the Docker service or WSL to make sure all the configurations are properly loaded.

  7. WSL Updates: Ensure that your WSL and Docker installation are up to date. Updates might include bug fixes or improvements that could potentially resolve the issue.

  8. Check Docker Version Compatibility: Verify that the version of Docker you're using within WSL is compatible with your environment. Sometimes there can be compatibility issues between Docker and WSL.

  9. Run Commands Manually: Instead of using the install.sh script, try running the Docker commands manually in the terminal to see if you can isolate the step where the issue occurs.

  10. Search for Similar Issues: Look for similar issues reported by others who are using Docker with WSL and Ubuntu. You might find solutions or workarounds that have worked for others.

  11. Test in Different Environment: If possible, try running the installation and Docker setup on a different system or environment (not WSL) to see if the issue persists. This can help determine if the problem is specific to your WSL setup.

  12. Contact Support: If you've exhausted all options and still can't resolve the issue, consider reaching out to Docker support or community forums for assistance.

PS: The script was tested in Real Linux OS and it works properly.

We'd be delighted to have you join our official forum! 🎉 It's a wonderful place where you can discover a wealth of answers, connect with a vibrant community, and share your insights and questions. Joining us there is a fantastic way to dive into engaging conversations, get valuable support, and be a part of a supportive network of enthusiasts just like you. We're excited to welcome you aboard and can't wait to see you there! Feel free to reach out if you have any more questions or if there's anything else we can assist you with. Thank you for considering becoming a part of our community! 🌟