Why does chown not work in RUN command in Docker?Why is one not allowed to use a Boolean in a docker-compose.yml?How to populate docker volumes in a build step to be used by a different containerDocker: strategy-advise for a rookieDocker build not picking up built jar?How to deploy my Express/React app to server with docker-compose and DockerfilesDocker not exposing port on mojave macJenkins run build in docker on server (withDockerServer not working)

The cat ate your input again!

80's/90's superhero cartoon with a man on fire and a man who made ice runways like Frozone

Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

Can anybody explain why using multicolumn changes the width of the four-column tabular environment?

What is this "Table of astronomy" about?

How to reduce Sinas Chinam

Train from Nagpur to Raipur

Halting problem in EXP-complete

Loading military units into ships optimally, using backtracking

AsyncDictionary - Can you break thread safety?

Lethal damage while controlling Sower of Discord?

TEMPO: play a (mp3) sound in animated GIF/PDF/SVG

How many people would you need to pull a whale over cobblestone streets?

Why command hierarchy, if the chain of command is standing next to each other?

Why are Tucker and Malcolm not dead?

Is there a standardised way to check fake news?

Annotating a table with arrows

How can this older-style irrigation tee be replaced?

Why does the standard fingering / strumming for a D maj chord leave out the 5th string?

How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?

Am I overreacting to my team leader's unethical requests?

Is it legal for a company to enter an agreement not to hire employees from another company?

How to take the beginning and end parts of a list with simpler syntax?



Why does chown not work in RUN command in Docker?


Why is one not allowed to use a Boolean in a docker-compose.yml?How to populate docker volumes in a build step to be used by a different containerDocker: strategy-advise for a rookieDocker build not picking up built jar?How to deploy my Express/React app to server with docker-compose and DockerfilesDocker not exposing port on mojave macJenkins run build in docker on server (withDockerServer not working)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I have the following docker-compose file:



version: '2'

networks:
default:
driver: bridge

services:

yii2-app:
build:
context: .
dockerfile: ./Dockerfile-app
ports:
- "80:80"
networks:
- default
depends_on:
- yii2-db
volumes:
- "./app:/var/www/app"
- "./nginx:/etc/nginx/sites-available"
...


Dockerfile-app:



FROM richarvey/nginx-php-fpm

ADD app /var/www/app

RUN rm -Rf /etc/nginx/sites-enabled/*

ADD nginx/site.conf /etc/nginx/sites-available/site.conf

RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf

RUN cd /var/www/app &&
composer install

RUN cd /var/www/app && chmod +x yii &&
cd web && mkdir -p uploads &&
cd /var/www && chown nginx:nginx -R app/


My last command RUN has no effect: chown does not set the nginx files owner. The folder "uploads" also is not created.



When I run docker-compose build --no-cache that step is passed:



Step 7/7 : RUN cd /var/www/app && chmod +x yii && cd web && mkdir -p uploads && cd /var/www && chown nginx:nginx -R app/
---> Running in 26a918bece47
Removing intermediate container 26a918bece47
---> 00db026a461c
Successfully built 00db026a461c
Successfully tagged passport-app_yii2-app:latest


However, when I run the workload in the "common" way using docker-compose up -d the change is not applied.



Why does my last RUN command not work?










share|improve this question









New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I think you could try to debug those statements by executing them one by one and see if there is an issue.

    – profesor79
    9 hours ago











  • @profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

    – Log
    9 hours ago

















3















I have the following docker-compose file:



version: '2'

networks:
default:
driver: bridge

services:

yii2-app:
build:
context: .
dockerfile: ./Dockerfile-app
ports:
- "80:80"
networks:
- default
depends_on:
- yii2-db
volumes:
- "./app:/var/www/app"
- "./nginx:/etc/nginx/sites-available"
...


Dockerfile-app:



FROM richarvey/nginx-php-fpm

ADD app /var/www/app

RUN rm -Rf /etc/nginx/sites-enabled/*

ADD nginx/site.conf /etc/nginx/sites-available/site.conf

RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf

RUN cd /var/www/app &&
composer install

RUN cd /var/www/app && chmod +x yii &&
cd web && mkdir -p uploads &&
cd /var/www && chown nginx:nginx -R app/


My last command RUN has no effect: chown does not set the nginx files owner. The folder "uploads" also is not created.



When I run docker-compose build --no-cache that step is passed:



Step 7/7 : RUN cd /var/www/app && chmod +x yii && cd web && mkdir -p uploads && cd /var/www && chown nginx:nginx -R app/
---> Running in 26a918bece47
Removing intermediate container 26a918bece47
---> 00db026a461c
Successfully built 00db026a461c
Successfully tagged passport-app_yii2-app:latest


However, when I run the workload in the "common" way using docker-compose up -d the change is not applied.



Why does my last RUN command not work?










share|improve this question









New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I think you could try to debug those statements by executing them one by one and see if there is an issue.

    – profesor79
    9 hours ago











  • @profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

    – Log
    9 hours ago













3












3








3








I have the following docker-compose file:



version: '2'

networks:
default:
driver: bridge

services:

yii2-app:
build:
context: .
dockerfile: ./Dockerfile-app
ports:
- "80:80"
networks:
- default
depends_on:
- yii2-db
volumes:
- "./app:/var/www/app"
- "./nginx:/etc/nginx/sites-available"
...


Dockerfile-app:



FROM richarvey/nginx-php-fpm

ADD app /var/www/app

RUN rm -Rf /etc/nginx/sites-enabled/*

ADD nginx/site.conf /etc/nginx/sites-available/site.conf

RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf

RUN cd /var/www/app &&
composer install

RUN cd /var/www/app && chmod +x yii &&
cd web && mkdir -p uploads &&
cd /var/www && chown nginx:nginx -R app/


My last command RUN has no effect: chown does not set the nginx files owner. The folder "uploads" also is not created.



When I run docker-compose build --no-cache that step is passed:



Step 7/7 : RUN cd /var/www/app && chmod +x yii && cd web && mkdir -p uploads && cd /var/www && chown nginx:nginx -R app/
---> Running in 26a918bece47
Removing intermediate container 26a918bece47
---> 00db026a461c
Successfully built 00db026a461c
Successfully tagged passport-app_yii2-app:latest


However, when I run the workload in the "common" way using docker-compose up -d the change is not applied.



Why does my last RUN command not work?










share|improve this question









New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have the following docker-compose file:



version: '2'

networks:
default:
driver: bridge

services:

yii2-app:
build:
context: .
dockerfile: ./Dockerfile-app
ports:
- "80:80"
networks:
- default
depends_on:
- yii2-db
volumes:
- "./app:/var/www/app"
- "./nginx:/etc/nginx/sites-available"
...


Dockerfile-app:



FROM richarvey/nginx-php-fpm

ADD app /var/www/app

RUN rm -Rf /etc/nginx/sites-enabled/*

ADD nginx/site.conf /etc/nginx/sites-available/site.conf

RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf

RUN cd /var/www/app &&
composer install

RUN cd /var/www/app && chmod +x yii &&
cd web && mkdir -p uploads &&
cd /var/www && chown nginx:nginx -R app/


My last command RUN has no effect: chown does not set the nginx files owner. The folder "uploads" also is not created.



When I run docker-compose build --no-cache that step is passed:



Step 7/7 : RUN cd /var/www/app && chmod +x yii && cd web && mkdir -p uploads && cd /var/www && chown nginx:nginx -R app/
---> Running in 26a918bece47
Removing intermediate container 26a918bece47
---> 00db026a461c
Successfully built 00db026a461c
Successfully tagged passport-app_yii2-app:latest


However, when I run the workload in the "common" way using docker-compose up -d the change is not applied.



Why does my last RUN command not work?







docker docker-compose






share|improve this question









New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 2 hours ago









Pierre.Vriens

3,7613 gold badges17 silver badges54 bronze badges




3,7613 gold badges17 silver badges54 bronze badges






New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 11 hours ago









LogLog

664 bronze badges




664 bronze badges




New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

















  • I think you could try to debug those statements by executing them one by one and see if there is an issue.

    – profesor79
    9 hours ago











  • @profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

    – Log
    9 hours ago

















  • I think you could try to debug those statements by executing them one by one and see if there is an issue.

    – profesor79
    9 hours ago











  • @profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

    – Log
    9 hours ago
















I think you could try to debug those statements by executing them one by one and see if there is an issue.

– profesor79
9 hours ago





I think you could try to debug those statements by executing them one by one and see if there is an issue.

– profesor79
9 hours ago













@profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

– Log
9 hours ago





@profesor79 It seems like in Docker I can not create file (folder, make chown) in /var/www/app, because it's volume.

– Log
9 hours ago










1 Answer
1






active

oldest

votes


















5














I found the reason of the problem.
In Docker "anything after the VOLUME instruction in a Dockerfile will not be able to make changes to that volume".
I define volume "./app:/var/www/app", and after that manipulate with it, so it's not work.






share|improve this answer








New contributor



Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "674"
    ;
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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
    );



    );






    Log is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdevops.stackexchange.com%2fquestions%2f8872%2fwhy-does-chown-not-work-in-run-command-in-docker%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    I found the reason of the problem.
    In Docker "anything after the VOLUME instruction in a Dockerfile will not be able to make changes to that volume".
    I define volume "./app:/var/www/app", and after that manipulate with it, so it's not work.






    share|improve this answer








    New contributor



    Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      5














      I found the reason of the problem.
      In Docker "anything after the VOLUME instruction in a Dockerfile will not be able to make changes to that volume".
      I define volume "./app:/var/www/app", and after that manipulate with it, so it's not work.






      share|improve this answer








      New contributor



      Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        5












        5








        5







        I found the reason of the problem.
        In Docker "anything after the VOLUME instruction in a Dockerfile will not be able to make changes to that volume".
        I define volume "./app:/var/www/app", and after that manipulate with it, so it's not work.






        share|improve this answer








        New contributor



        Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        I found the reason of the problem.
        In Docker "anything after the VOLUME instruction in a Dockerfile will not be able to make changes to that volume".
        I define volume "./app:/var/www/app", and after that manipulate with it, so it's not work.







        share|improve this answer








        New contributor



        Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share|improve this answer



        share|improve this answer






        New contributor



        Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        answered 9 hours ago









        LogLog

        664 bronze badges




        664 bronze badges




        New contributor



        Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




        New contributor




        Log is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.

























            Log is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Log is a new contributor. Be nice, and check out our Code of Conduct.












            Log is a new contributor. Be nice, and check out our Code of Conduct.











            Log is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to DevOps Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdevops.stackexchange.com%2fquestions%2f8872%2fwhy-does-chown-not-work-in-run-command-in-docker%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

            The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

            19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу