Build docker image from layers
up vote
0
down vote
favorite
I have a big docker image I need to copy to a remote machine.
I build the image on my local machine with an unchanging base image, so only the last few layers change.
I would like to have that base image on the remote machine and only copy the changed top layers to the remote machine whenever they change. I cannot build the image on the remote using its dockerfile because the necessary source files are not present on the remote.
I can separate the image into its layers using undocker, but how do I reassemble the image from its layers on the remote machine?
docker
add a comment |
up vote
0
down vote
favorite
I have a big docker image I need to copy to a remote machine.
I build the image on my local machine with an unchanging base image, so only the last few layers change.
I would like to have that base image on the remote machine and only copy the changed top layers to the remote machine whenever they change. I cannot build the image on the remote using its dockerfile because the necessary source files are not present on the remote.
I can separate the image into its layers using undocker, but how do I reassemble the image from its layers on the remote machine?
docker
1
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
If you really don't have a registry available, I wonder if it would work todocker save
the image, unpack the tarball,rsync
that to the remote system, rebuild the tarball, anddocker load
the result. That won't be fast in Docker time, but it would probably save network I/O.
– David Maze
Nov 8 at 11:11
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a big docker image I need to copy to a remote machine.
I build the image on my local machine with an unchanging base image, so only the last few layers change.
I would like to have that base image on the remote machine and only copy the changed top layers to the remote machine whenever they change. I cannot build the image on the remote using its dockerfile because the necessary source files are not present on the remote.
I can separate the image into its layers using undocker, but how do I reassemble the image from its layers on the remote machine?
docker
I have a big docker image I need to copy to a remote machine.
I build the image on my local machine with an unchanging base image, so only the last few layers change.
I would like to have that base image on the remote machine and only copy the changed top layers to the remote machine whenever they change. I cannot build the image on the remote using its dockerfile because the necessary source files are not present on the remote.
I can separate the image into its layers using undocker, but how do I reassemble the image from its layers on the remote machine?
docker
docker
asked Nov 8 at 7:17
warakawa
351413
351413
1
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
If you really don't have a registry available, I wonder if it would work todocker save
the image, unpack the tarball,rsync
that to the remote system, rebuild the tarball, anddocker load
the result. That won't be fast in Docker time, but it would probably save network I/O.
– David Maze
Nov 8 at 11:11
add a comment |
1
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
If you really don't have a registry available, I wonder if it would work todocker save
the image, unpack the tarball,rsync
that to the remote system, rebuild the tarball, anddocker load
the result. That won't be fast in Docker time, but it would probably save network I/O.
– David Maze
Nov 8 at 11:11
1
1
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
If you really don't have a registry available, I wonder if it would work to
docker save
the image, unpack the tarball, rsync
that to the remote system, rebuild the tarball, and docker load
the result. That won't be fast in Docker time, but it would probably save network I/O.– David Maze
Nov 8 at 11:11
If you really don't have a registry available, I wonder if it would work to
docker save
the image, unpack the tarball, rsync
that to the remote system, rebuild the tarball, and docker load
the result. That won't be fast in Docker time, but it would probably save network I/O.– David Maze
Nov 8 at 11:11
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
I've never worked with undocker tool so I can't comment on this, but in my understanding image in docker is a "sealed package" ready for distribution in one way or another.
So copying part of the image sounds to me like distributing a part of the package.
I can understand that overhead of big image on the other hand (probably you're looking for faster copying), but it contradicts the docker "ideology" (take image "as is" and work with it)
So, probably the most straightforward option is preparing the sources (those are in the "last few layers") as a distributable package without docker, copying them to the remote machine and then building the image on the remote machine out of a base image and this distributable package
This allows overcoming a workaround of "the necessary source files are not present on the remote" as you say
add a comment |
up vote
0
down vote
accepted
I have switched to using a Docker registry, and updating my image with docker pull
, which I think is the proper way to solve this problem, since it will only download the changed layers.
This article also helped me reduce the size of my images.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I've never worked with undocker tool so I can't comment on this, but in my understanding image in docker is a "sealed package" ready for distribution in one way or another.
So copying part of the image sounds to me like distributing a part of the package.
I can understand that overhead of big image on the other hand (probably you're looking for faster copying), but it contradicts the docker "ideology" (take image "as is" and work with it)
So, probably the most straightforward option is preparing the sources (those are in the "last few layers") as a distributable package without docker, copying them to the remote machine and then building the image on the remote machine out of a base image and this distributable package
This allows overcoming a workaround of "the necessary source files are not present on the remote" as you say
add a comment |
up vote
0
down vote
I've never worked with undocker tool so I can't comment on this, but in my understanding image in docker is a "sealed package" ready for distribution in one way or another.
So copying part of the image sounds to me like distributing a part of the package.
I can understand that overhead of big image on the other hand (probably you're looking for faster copying), but it contradicts the docker "ideology" (take image "as is" and work with it)
So, probably the most straightforward option is preparing the sources (those are in the "last few layers") as a distributable package without docker, copying them to the remote machine and then building the image on the remote machine out of a base image and this distributable package
This allows overcoming a workaround of "the necessary source files are not present on the remote" as you say
add a comment |
up vote
0
down vote
up vote
0
down vote
I've never worked with undocker tool so I can't comment on this, but in my understanding image in docker is a "sealed package" ready for distribution in one way or another.
So copying part of the image sounds to me like distributing a part of the package.
I can understand that overhead of big image on the other hand (probably you're looking for faster copying), but it contradicts the docker "ideology" (take image "as is" and work with it)
So, probably the most straightforward option is preparing the sources (those are in the "last few layers") as a distributable package without docker, copying them to the remote machine and then building the image on the remote machine out of a base image and this distributable package
This allows overcoming a workaround of "the necessary source files are not present on the remote" as you say
I've never worked with undocker tool so I can't comment on this, but in my understanding image in docker is a "sealed package" ready for distribution in one way or another.
So copying part of the image sounds to me like distributing a part of the package.
I can understand that overhead of big image on the other hand (probably you're looking for faster copying), but it contradicts the docker "ideology" (take image "as is" and work with it)
So, probably the most straightforward option is preparing the sources (those are in the "last few layers") as a distributable package without docker, copying them to the remote machine and then building the image on the remote machine out of a base image and this distributable package
This allows overcoming a workaround of "the necessary source files are not present on the remote" as you say
answered Nov 8 at 7:31
Mark Bramnik
11.2k32445
11.2k32445
add a comment |
add a comment |
up vote
0
down vote
accepted
I have switched to using a Docker registry, and updating my image with docker pull
, which I think is the proper way to solve this problem, since it will only download the changed layers.
This article also helped me reduce the size of my images.
add a comment |
up vote
0
down vote
accepted
I have switched to using a Docker registry, and updating my image with docker pull
, which I think is the proper way to solve this problem, since it will only download the changed layers.
This article also helped me reduce the size of my images.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I have switched to using a Docker registry, and updating my image with docker pull
, which I think is the proper way to solve this problem, since it will only download the changed layers.
This article also helped me reduce the size of my images.
I have switched to using a Docker registry, and updating my image with docker pull
, which I think is the proper way to solve this problem, since it will only download the changed layers.
This article also helped me reduce the size of my images.
answered Nov 29 at 6:00
warakawa
351413
351413
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53203000%2fbuild-docker-image-from-layers%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
why you done push your image to dockerhub then acces to remote server and pull it ?
– Truong Dang
Nov 8 at 7:32
If you really don't have a registry available, I wonder if it would work to
docker save
the image, unpack the tarball,rsync
that to the remote system, rebuild the tarball, anddocker load
the result. That won't be fast in Docker time, but it would probably save network I/O.– David Maze
Nov 8 at 11:11