Continue building Docker image after error occured
I have a Dockerfile that install Ubuntu and some packages over it and then proceeds to use these packages. Let's say I need to run 'wget' command, but forgot to issue install of the 'wget' package. I add the package to install command and continue with my execution. However I have to start over - install Ubuntu, install package, etc., or do I? Is there ability to save what I did until error occurred and continue from that point after I did my fixes instead of downloading everything again?
docker
add a comment |
I have a Dockerfile that install Ubuntu and some packages over it and then proceeds to use these packages. Let's say I need to run 'wget' command, but forgot to issue install of the 'wget' package. I add the package to install command and continue with my execution. However I have to start over - install Ubuntu, install package, etc., or do I? Is there ability to save what I did until error occurred and continue from that point after I did my fixes instead of downloading everything again?
docker
1
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
If you re-rundocker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.
– David Maze
Jan 2 at 0:38
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
Any time anything changes, none of the later steps will be cached. Since you haveCOPY . /camera
very early in the Dockerfile, the followingRUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
– David Maze
Jan 2 at 10:30
Thank you David
– Alex Kravets
Jan 2 at 11:51
add a comment |
I have a Dockerfile that install Ubuntu and some packages over it and then proceeds to use these packages. Let's say I need to run 'wget' command, but forgot to issue install of the 'wget' package. I add the package to install command and continue with my execution. However I have to start over - install Ubuntu, install package, etc., or do I? Is there ability to save what I did until error occurred and continue from that point after I did my fixes instead of downloading everything again?
docker
I have a Dockerfile that install Ubuntu and some packages over it and then proceeds to use these packages. Let's say I need to run 'wget' command, but forgot to issue install of the 'wget' package. I add the package to install command and continue with my execution. However I have to start over - install Ubuntu, install package, etc., or do I? Is there ability to save what I did until error occurred and continue from that point after I did my fixes instead of downloading everything again?
docker
docker
asked Jan 1 at 22:54
Alex KravetsAlex Kravets
1,86221217
1,86221217
1
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
If you re-rundocker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.
– David Maze
Jan 2 at 0:38
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
Any time anything changes, none of the later steps will be cached. Since you haveCOPY . /camera
very early in the Dockerfile, the followingRUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
– David Maze
Jan 2 at 10:30
Thank you David
– Alex Kravets
Jan 2 at 11:51
add a comment |
1
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
If you re-rundocker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.
– David Maze
Jan 2 at 0:38
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
Any time anything changes, none of the later steps will be cached. Since you haveCOPY . /camera
very early in the Dockerfile, the followingRUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
– David Maze
Jan 2 at 10:30
Thank you David
– Alex Kravets
Jan 2 at 11:51
1
1
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
If you re-run
docker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.– David Maze
Jan 2 at 0:38
If you re-run
docker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.– David Maze
Jan 2 at 0:38
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
Any time anything changes, none of the later steps will be cached. Since you have
COPY . /camera
very early in the Dockerfile, the following RUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.– David Maze
Jan 2 at 10:30
Any time anything changes, none of the later steps will be cached. Since you have
COPY . /camera
very early in the Dockerfile, the following RUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.– David Maze
Jan 2 at 10:30
Thank you David
– Alex Kravets
Jan 2 at 11:51
Thank you David
– Alex Kravets
Jan 2 at 11:51
add a comment |
2 Answers
2
active
oldest
votes
Sometimes for this instance you might want to subdivide your build into a chain of images. Each successive step picks up the previous step at the FROM command.
add a comment |
Just to point out that David Maze's answer was most appropriate for my case:
Any time anything changes, none of the later steps will be cached. Since you have COPY . /camera very early in the Dockerfile, the following RUN apt-get ... becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
This is what I had COPY command in a wrong place, which really makes sense - I copy everything docker accumulated before resolving what I needed so I ended executing all directives after COPY every time I build the image. After I moved COPY down as David suggested, all the cached data was there.
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%2f53999573%2fcontinue-building-docker-image-after-error-occured%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
Sometimes for this instance you might want to subdivide your build into a chain of images. Each successive step picks up the previous step at the FROM command.
add a comment |
Sometimes for this instance you might want to subdivide your build into a chain of images. Each successive step picks up the previous step at the FROM command.
add a comment |
Sometimes for this instance you might want to subdivide your build into a chain of images. Each successive step picks up the previous step at the FROM command.
Sometimes for this instance you might want to subdivide your build into a chain of images. Each successive step picks up the previous step at the FROM command.
answered Jan 2 at 1:29
Richard BarberRichard Barber
26316
26316
add a comment |
add a comment |
Just to point out that David Maze's answer was most appropriate for my case:
Any time anything changes, none of the later steps will be cached. Since you have COPY . /camera very early in the Dockerfile, the following RUN apt-get ... becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
This is what I had COPY command in a wrong place, which really makes sense - I copy everything docker accumulated before resolving what I needed so I ended executing all directives after COPY every time I build the image. After I moved COPY down as David suggested, all the cached data was there.
add a comment |
Just to point out that David Maze's answer was most appropriate for my case:
Any time anything changes, none of the later steps will be cached. Since you have COPY . /camera very early in the Dockerfile, the following RUN apt-get ... becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
This is what I had COPY command in a wrong place, which really makes sense - I copy everything docker accumulated before resolving what I needed so I ended executing all directives after COPY every time I build the image. After I moved COPY down as David suggested, all the cached data was there.
add a comment |
Just to point out that David Maze's answer was most appropriate for my case:
Any time anything changes, none of the later steps will be cached. Since you have COPY . /camera very early in the Dockerfile, the following RUN apt-get ... becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
This is what I had COPY command in a wrong place, which really makes sense - I copy everything docker accumulated before resolving what I needed so I ended executing all directives after COPY every time I build the image. After I moved COPY down as David suggested, all the cached data was there.
Just to point out that David Maze's answer was most appropriate for my case:
Any time anything changes, none of the later steps will be cached. Since you have COPY . /camera very early in the Dockerfile, the following RUN apt-get ... becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.
This is what I had COPY command in a wrong place, which really makes sense - I copy everything docker accumulated before resolving what I needed so I ended executing all directives after COPY every time I build the image. After I moved COPY down as David suggested, all the cached data was there.
answered Jan 2 at 18:53
Alex KravetsAlex Kravets
1,86221217
1,86221217
add a comment |
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%2f53999573%2fcontinue-building-docker-image-after-error-occured%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
1
Sometimes for this instance you might want to subdivide your build into a sequence of images. Each successive step picks up the previous step at the FROM command.
– Richard Barber
Jan 2 at 0:14
If you re-run
docker build
it will essentially skip over steps it's already done. See for example "Leverage build cache" in "Best practices for writing Dockerfiles" in the Docker documentation.– David Maze
Jan 2 at 0:38
@DavidMaze That's interesting because it looks like every time I build my docker, it's starts fresh. May be I am not issues enough commands? As I understand cache is automatic. Here is my Dockerfile github.com/akravets/bus-notify/blob/master/Dockerfile
– Alex Kravets
Jan 2 at 3:12
Any time anything changes, none of the later steps will be cached. Since you have
COPY . /camera
very early in the Dockerfile, the followingRUN apt-get ...
becomes non-cacheable if anything changes at all in your source tree. I'd move that to later.– David Maze
Jan 2 at 10:30
Thank you David
– Alex Kravets
Jan 2 at 11:51