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;
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
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.
add a comment |
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
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
add a comment |
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
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
docker docker-compose
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.
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
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.
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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.
add a comment |
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.
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.
add a comment |
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.
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.
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.
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.
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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