Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with exercise 1.9 when using WSL2 #122

Open
anttijman opened this issue Sep 13, 2021 · 0 comments
Open

Problem with exercise 1.9 when using WSL2 #122

anttijman opened this issue Sep 13, 2021 · 0 comments

Comments

@anttijman
Copy link

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:

  1. Use WSL2 ubuntu
  2. Make sure you do not have a file named text.log in your working directory
  3. Run
    docker run -v "$(pwd)/text.log:/usr/src/app/text.log" devopsdockeruh/simple-web-service
  4. Creates a directory named text.log in your host machine working directory
  5. Remove the directory text.log from your working directory
    rm -r text.log
  6. Create a file text.log
    touch text.log
  7. Rerun command from step two
  8. Outputs an error
    docker: Error response from daemon: not a directory

See: docker/for-win#9823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant