-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Description
I faced a problem in exercise 1.9 when using WSL2.
When using -v to bind mount a file, and the file does not exist on host machine, a directory is created by default. The file has to be created before executing the command
docker -run -v "$(pwd)/text.log:/usr/src/app/text.log" devopsdockeruh/simple-web-service
So, the problem is that even if you remove the directory text.log from host machine after first time, and then create the file text.log on host machine, and then rerun the same command it outputs an error message: docker: Error response from daemon: not a directory.
I overcame the problem with bind mounting the file with a different name.
Steps to reproduce:
- Use WSL2 ubuntu
- Make sure you do not have a file named text.log in your working directory
- Run
docker run -v "$(pwd)/text.log:/usr/src/app/text.log" devopsdockeruh/simple-web-service
- Creates a directory named text.log in your host machine working directory
- Remove the directory text.log from your working directory
rm -r text.log
- Create a file text.log
touch text.log
- Rerun command from step two
- Outputs an error
docker: Error response from daemon: not a directory
See: docker/for-win#9823
PavelPashov
Metadata
Metadata
Assignees
Labels
No labels