Mount bind volume

I cannot mount a folder from my windows filesystem to my container filesystem using a compose.yaml file;

this is my versione of wsl:

Versione WSL: 2.2.4.0
Versione kernel: 5.15.153.1-2
Versione WSLg: 1.0.61
Versione MSRDC: 1.2.5326
Versione Direct3D: 1.611.1-81528511
Versione DXCore: 10.0.26091.1-240325-1447.ge-release
Versione di Windows: 10.0.19045.5011

this is my docker-compose.yaml file

services:
  assessementonline:
    container_name: assessementonline
    image: mcr.microsoft.com/openjdk/jdk:17-ubuntu
    ports:
      - "4006:4006"
    volumes:
      - "C:/User/viscomi/tutorial_docker/assess/AmazonAcademy/backend/target:/app"
    working_dir: /app
    
    entrypoint: ["java", "-jar" ,"/app/assessementonline.jar"]
    restart: unless-stopped

Inside the volume tag i tested almost everithin (chage blakslash, change /mnt/c/ etc ) but no one is usuful for me, try out also what is described in
how to mount volume

I know my jar file is in the path:
C:/User/viscomi/tutorial_docker/assess/AmazonAcademy/backend/target
but after running the command:

docker compose up

it tells me:

and on docker the folder semm mounted but empty:

Have you tried using Windows formatted paths? (\ instead of /)

yes I have tried:

  • ā€œC:\User\viscomi\tutorial_docker\assess\AmazonAcademy\backend\target:/appā€
    and also
  • ā€œC:\User\viscomi\tutorial_docker\assess\AmazonAcademy\backend\target:/appā€

in the first case same error, in the second case I get
yaml: line 8: did not find expected hexdecimal number

Both paths you posted are the same(?)

Have you tried /c/User/...?

1 Like

As I asked you in the other topic:


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
services:
  service1:
    image: image1
```

After fixing your post, please send a new comment so people are notified about the fixed content.


Sorry for the late in teh answer; Anyway Iā€™m not able to see the button to modify my post, but the error was:

entrypoint: ["java", "-jar" ,"assessmentonline.jar"]

the word assessmentonline has a character that shouldnā€™t have!!!

So no more imagine and code inside </>

It is available only for a day for new users. I fixed the yaml block for you now.

I see. So it was ā€œassessementā€ instead of ā€œassessmentā€