docker COPY command is not persistent
I have a docker file with the following lines:
WORKDIR /volumes/code/
COPY migrations migrations
COPY templates templates
COPY server.py server.py
COPY restart_db.py restart_db.py
COPY alembic.ini alembic.ini
but after the container is up and running and im in that folder, some files are there and other aren't:
root@512ac3d735ee:/volumes/code# ls
autoai config restart_db.py
Even though that the COPY command passed successfully:
Step 3/9 : WORKDIR /volumes/code/
---> Running in c02e5b2ed596
Removing intermediate container c02e5b2ed596
---> 682a6cb503b6
Step 4/9 : COPY migrations migrations
---> 26820b3fa035
Step 5/9 : COPY templates templates
---> f603b8e32dcb
Step 6/9 : COPY server.py server.py
---> 28877c2cbe1f
Step 7/9 : COPY restart_db.py restart_db.py
---> 6b15df227249
Step 8/9 : COPY alembic.ini alembic.ini
---> a8a9891b38fc
and the files exist in the same folder.
for example. restart_db.py
and server.py
are in the same folder but only restart_db.py
is copied to the container.
Note: /volumes/code/ is a mounted directory
docker
add a comment |
I have a docker file with the following lines:
WORKDIR /volumes/code/
COPY migrations migrations
COPY templates templates
COPY server.py server.py
COPY restart_db.py restart_db.py
COPY alembic.ini alembic.ini
but after the container is up and running and im in that folder, some files are there and other aren't:
root@512ac3d735ee:/volumes/code# ls
autoai config restart_db.py
Even though that the COPY command passed successfully:
Step 3/9 : WORKDIR /volumes/code/
---> Running in c02e5b2ed596
Removing intermediate container c02e5b2ed596
---> 682a6cb503b6
Step 4/9 : COPY migrations migrations
---> 26820b3fa035
Step 5/9 : COPY templates templates
---> f603b8e32dcb
Step 6/9 : COPY server.py server.py
---> 28877c2cbe1f
Step 7/9 : COPY restart_db.py restart_db.py
---> 6b15df227249
Step 8/9 : COPY alembic.ini alembic.ini
---> a8a9891b38fc
and the files exist in the same folder.
for example. restart_db.py
and server.py
are in the same folder but only restart_db.py
is copied to the container.
Note: /volumes/code/ is a mounted directory
docker
An essential fact that should be mentioned in the question is that you mounted/volumes/code
as a volume.
– Henry
Nov 21 '18 at 12:08
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10
add a comment |
I have a docker file with the following lines:
WORKDIR /volumes/code/
COPY migrations migrations
COPY templates templates
COPY server.py server.py
COPY restart_db.py restart_db.py
COPY alembic.ini alembic.ini
but after the container is up and running and im in that folder, some files are there and other aren't:
root@512ac3d735ee:/volumes/code# ls
autoai config restart_db.py
Even though that the COPY command passed successfully:
Step 3/9 : WORKDIR /volumes/code/
---> Running in c02e5b2ed596
Removing intermediate container c02e5b2ed596
---> 682a6cb503b6
Step 4/9 : COPY migrations migrations
---> 26820b3fa035
Step 5/9 : COPY templates templates
---> f603b8e32dcb
Step 6/9 : COPY server.py server.py
---> 28877c2cbe1f
Step 7/9 : COPY restart_db.py restart_db.py
---> 6b15df227249
Step 8/9 : COPY alembic.ini alembic.ini
---> a8a9891b38fc
and the files exist in the same folder.
for example. restart_db.py
and server.py
are in the same folder but only restart_db.py
is copied to the container.
Note: /volumes/code/ is a mounted directory
docker
I have a docker file with the following lines:
WORKDIR /volumes/code/
COPY migrations migrations
COPY templates templates
COPY server.py server.py
COPY restart_db.py restart_db.py
COPY alembic.ini alembic.ini
but after the container is up and running and im in that folder, some files are there and other aren't:
root@512ac3d735ee:/volumes/code# ls
autoai config restart_db.py
Even though that the COPY command passed successfully:
Step 3/9 : WORKDIR /volumes/code/
---> Running in c02e5b2ed596
Removing intermediate container c02e5b2ed596
---> 682a6cb503b6
Step 4/9 : COPY migrations migrations
---> 26820b3fa035
Step 5/9 : COPY templates templates
---> f603b8e32dcb
Step 6/9 : COPY server.py server.py
---> 28877c2cbe1f
Step 7/9 : COPY restart_db.py restart_db.py
---> 6b15df227249
Step 8/9 : COPY alembic.ini alembic.ini
---> a8a9891b38fc
and the files exist in the same folder.
for example. restart_db.py
and server.py
are in the same folder but only restart_db.py
is copied to the container.
Note: /volumes/code/ is a mounted directory
docker
docker
edited Nov 21 '18 at 12:09
NotSoShabby
asked Nov 21 '18 at 9:22
NotSoShabbyNotSoShabby
293215
293215
An essential fact that should be mentioned in the question is that you mounted/volumes/code
as a volume.
– Henry
Nov 21 '18 at 12:08
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10
add a comment |
An essential fact that should be mentioned in the question is that you mounted/volumes/code
as a volume.
– Henry
Nov 21 '18 at 12:08
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10
An essential fact that should be mentioned in the question is that you mounted
/volumes/code
as a volume.– Henry
Nov 21 '18 at 12:08
An essential fact that should be mentioned in the question is that you mounted
/volumes/code
as a volume.– Henry
Nov 21 '18 at 12:08
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10
add a comment |
2 Answers
2
active
oldest
votes
What worked for me eventually is:
docker volume prune
and y
when prompted .
then running again.
add a comment |
Containers are supposed to be instances of running code that modify data. Data is supposed to be in volumes, not code.
The /volumes/code
should not be declared as a volume, either via docker-compose
or with the VOLUME
command.
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2fstackoverflow.com%2fquestions%2f53408790%2fdocker-copy-command-is-not-persistent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
What worked for me eventually is:
docker volume prune
and y
when prompted .
then running again.
add a comment |
What worked for me eventually is:
docker volume prune
and y
when prompted .
then running again.
add a comment |
What worked for me eventually is:
docker volume prune
and y
when prompted .
then running again.
What worked for me eventually is:
docker volume prune
and y
when prompted .
then running again.
answered Nov 21 '18 at 11:53
NotSoShabbyNotSoShabby
293215
293215
add a comment |
add a comment |
Containers are supposed to be instances of running code that modify data. Data is supposed to be in volumes, not code.
The /volumes/code
should not be declared as a volume, either via docker-compose
or with the VOLUME
command.
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
add a comment |
Containers are supposed to be instances of running code that modify data. Data is supposed to be in volumes, not code.
The /volumes/code
should not be declared as a volume, either via docker-compose
or with the VOLUME
command.
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
add a comment |
Containers are supposed to be instances of running code that modify data. Data is supposed to be in volumes, not code.
The /volumes/code
should not be declared as a volume, either via docker-compose
or with the VOLUME
command.
Containers are supposed to be instances of running code that modify data. Data is supposed to be in volumes, not code.
The /volumes/code
should not be declared as a volume, either via docker-compose
or with the VOLUME
command.
edited Nov 21 '18 at 12:02
answered Nov 21 '18 at 10:49


Ricardo BrancoRicardo Branco
3,3021714
3,3021714
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
add a comment |
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
I don't quit understand what you mean..
– NotSoShabby
Nov 21 '18 at 11:54
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
Post the complete Dockerfile (or the complete log for the build as much as you can).
– Ricardo Branco
Nov 21 '18 at 11:55
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
The above is pretty much the whole docker file. Only "FROM python:3.6-slim" on top and "CMD tail -f /dev/null" on the bottom to keep it running. I ran it through docker-compose which mounts /volumes/code on other containers as well
– NotSoShabby
Nov 21 '18 at 11:58
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
See my edited answer.
– Ricardo Branco
Nov 21 '18 at 12:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53408790%2fdocker-copy-command-is-not-persistent%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
An essential fact that should be mentioned in the question is that you mounted
/volumes/code
as a volume.– Henry
Nov 21 '18 at 12:08
You're right. edited.
– NotSoShabby
Nov 21 '18 at 12:10