Error mounting a config file into the container











up vote
4
down vote

favorite
1












Edit: I'm on windows.



I am experimenting with docker-compose. I know that I should use a Dockerfile to copy a file into the container, but I want to solve it by mounting the file because that is easier at the moment for my experiments. I also want to take this as a learning experience on what the issue is here.



My docker-compose.yml looks like this:



version: "3"
services:
webserver:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./webapp.conf:/etc/nginx/conf.d/default.conf
webapp:
image: wordpress:php7.1-fpm


when running docker-compose up I see the following error message:



PS C:UsersdanielDocumentsDocker> docker-compose up
Removing docker_webserver_1
Recreating ed1b21e6939c_docker_webserver_1
docker_webapp_1 is up-to-date

ERROR: for webserver Cannot start service webserver: error while creating mount source path '/C/Users/daniel/Documents/Docker/webapp.conf': mkdir /C/Users/daniel/Documents: permission denied
ERROR: Encountered errors while bringing up the project.


What am I doing wrong.










share|improve this question




























    up vote
    4
    down vote

    favorite
    1












    Edit: I'm on windows.



    I am experimenting with docker-compose. I know that I should use a Dockerfile to copy a file into the container, but I want to solve it by mounting the file because that is easier at the moment for my experiments. I also want to take this as a learning experience on what the issue is here.



    My docker-compose.yml looks like this:



    version: "3"
    services:
    webserver:
    image: nginx:latest
    ports:
    - "80:80"
    volumes:
    - ./webapp.conf:/etc/nginx/conf.d/default.conf
    webapp:
    image: wordpress:php7.1-fpm


    when running docker-compose up I see the following error message:



    PS C:UsersdanielDocumentsDocker> docker-compose up
    Removing docker_webserver_1
    Recreating ed1b21e6939c_docker_webserver_1
    docker_webapp_1 is up-to-date

    ERROR: for webserver Cannot start service webserver: error while creating mount source path '/C/Users/daniel/Documents/Docker/webapp.conf': mkdir /C/Users/daniel/Documents: permission denied
    ERROR: Encountered errors while bringing up the project.


    What am I doing wrong.










    share|improve this question


























      up vote
      4
      down vote

      favorite
      1









      up vote
      4
      down vote

      favorite
      1






      1





      Edit: I'm on windows.



      I am experimenting with docker-compose. I know that I should use a Dockerfile to copy a file into the container, but I want to solve it by mounting the file because that is easier at the moment for my experiments. I also want to take this as a learning experience on what the issue is here.



      My docker-compose.yml looks like this:



      version: "3"
      services:
      webserver:
      image: nginx:latest
      ports:
      - "80:80"
      volumes:
      - ./webapp.conf:/etc/nginx/conf.d/default.conf
      webapp:
      image: wordpress:php7.1-fpm


      when running docker-compose up I see the following error message:



      PS C:UsersdanielDocumentsDocker> docker-compose up
      Removing docker_webserver_1
      Recreating ed1b21e6939c_docker_webserver_1
      docker_webapp_1 is up-to-date

      ERROR: for webserver Cannot start service webserver: error while creating mount source path '/C/Users/daniel/Documents/Docker/webapp.conf': mkdir /C/Users/daniel/Documents: permission denied
      ERROR: Encountered errors while bringing up the project.


      What am I doing wrong.










      share|improve this question















      Edit: I'm on windows.



      I am experimenting with docker-compose. I know that I should use a Dockerfile to copy a file into the container, but I want to solve it by mounting the file because that is easier at the moment for my experiments. I also want to take this as a learning experience on what the issue is here.



      My docker-compose.yml looks like this:



      version: "3"
      services:
      webserver:
      image: nginx:latest
      ports:
      - "80:80"
      volumes:
      - ./webapp.conf:/etc/nginx/conf.d/default.conf
      webapp:
      image: wordpress:php7.1-fpm


      when running docker-compose up I see the following error message:



      PS C:UsersdanielDocumentsDocker> docker-compose up
      Removing docker_webserver_1
      Recreating ed1b21e6939c_docker_webserver_1
      docker_webapp_1 is up-to-date

      ERROR: for webserver Cannot start service webserver: error while creating mount source path '/C/Users/daniel/Documents/Docker/webapp.conf': mkdir /C/Users/daniel/Documents: permission denied
      ERROR: Encountered errors while bringing up the project.


      What am I doing wrong.







      windows docker docker-compose






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 13 hours ago









      h3xStream

      4,46422840




      4,46422840










      asked May 3 '17 at 9:18









      Daniel

      79611233




      79611233
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          (I added the same problem few minutes ago.)



          Make sure your docker is allowed to mount the directory C:Users[redacted]DocumentsDocker



          Configuration



          In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.



          enter image description here



          Already configured ?



          In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43755922%2ferror-mounting-a-config-file-into-the-container%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote



            accepted










            (I added the same problem few minutes ago.)



            Make sure your docker is allowed to mount the directory C:Users[redacted]DocumentsDocker



            Configuration



            In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.



            enter image description here



            Already configured ?



            In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.






            share|improve this answer



























              up vote
              6
              down vote



              accepted










              (I added the same problem few minutes ago.)



              Make sure your docker is allowed to mount the directory C:Users[redacted]DocumentsDocker



              Configuration



              In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.



              enter image description here



              Already configured ?



              In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.






              share|improve this answer

























                up vote
                6
                down vote



                accepted







                up vote
                6
                down vote



                accepted






                (I added the same problem few minutes ago.)



                Make sure your docker is allowed to mount the directory C:Users[redacted]DocumentsDocker



                Configuration



                In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.



                enter image description here



                Already configured ?



                In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.






                share|improve this answer














                (I added the same problem few minutes ago.)



                Make sure your docker is allowed to mount the directory C:Users[redacted]DocumentsDocker



                Configuration



                In the Windows client, you can configure the docker to allow read/write on specific drives. This should fix your permissions problem.



                enter image description here



                Already configured ?



                In my case, it was already selected. I unchecked and checked the drive again. Apply the "change". It prompted me for my Windows password (which had change) and than the mount worked again.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 7 at 17:56

























                answered May 3 '17 at 18:34









                h3xStream

                4,46422840




                4,46422840






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43755922%2ferror-mounting-a-config-file-into-the-container%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?