-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for pull on all hosts (no change in docker run) #349
Conversation
I think its the best solution for the time being. |
A few points:
|
Should we intercept |
Unfortunately, |
|
+1 we need this! yay! My concerns with the implementation are similar to @aluzzardi's. Also – what if you commit an image? How does that image get propagated to other nodes in the cluster? Perhaps instead of each node having all of the images, a swarm could be attached to a registry which represented the images in a swarm. When a container is created, the assigned node could pull the image from the registry. When you commit, the image gets pushed to the registry. Also – another crazy idea: what if Engines could push and pull to each other? Perhaps the images in a swarm could be an aggregate of the images on each of the nodes. When a node in the cluster needed an image that was on another node, it could pull from that node. /cc @stevvooe @dmp42 who have had similar ideas |
@bfirsh We can break this down using the following rules:
From this, it follows that using the run command may result in an "internal pull". If an image cannot be resolved in the local cluster (read "swarm registry"), the run command would fail. I'm not sure if runtime image resolution exists currently, but a pluggable registry for internal clusters would make this possible. As a side note, pulling all images to all machines is a huge problem for large deployments. Imagine the read amplification for a small deployment on a large cluster, where the application is deployment to a small percentage of nodes. |
maybe the option to apply the filter in |
The thing is, we are limited by the docker cli, and right now the cli We also tried See #337 for reference. On Fri, Feb 20, 2015 at 11:35 AM, allisonvoll notifications@github.com
Victor Vieux |
What about maintaining a mapping of images to filters? On a create call that requests image X with filter constraint=ssd store the X->[filter1, filter2] relationship. Any subsequent pull for X (e.g. from the client that just got a 404 on create) will trigger the pull on all hosts that match the cached filters for image X. If there are no associated filters, pull everywhere. For new nodes, walk the data in reverse to find images that match the node. |
+1 for the ability to pre-fetch images onto every swarm host!
I think this is actually a great thing that the global pull occurs on a
👍 for "smart" operations on node joins. I can see that we could add "smart" node re-balancing scheduler strategies with this workflow in the future, too :) |
Victor has announced that there is a plan for Swarm manager to be HA and leader election through Raft . If there is a way for swarm manager to store or cache the images that are being pulled on a node and while creating a container on a different node other than the one that has the image , then the node can simply pull from the swarm manager --> just requires to edit the image or json template for the pull request from manager to node . |
@vieux I don't have a solution for the CLI aspect, other than tying image fetch to a resource offer framework. I would respectfully request that you avoid the |
@stevvooe thanks for pointing that out. In any case, we are avoiding it, because it is not possible with today's CLI. @gabrtv @aluzzardi I updated the PR to remove the pull on docker run. To use private images, you'll have to docker pull (on every node) manually. |
I updated the title and description to make things more accurate. /cc @aluzzardi |
@@ -186,6 +186,14 @@ func (c *Cluster) Image(IdOrName string) *cluster.Image { | |||
return nil | |||
} | |||
|
|||
func (c *Cluster) Pull(name string, begin, end func(string)) { | |||
for _, node := range c.nodes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably happen in parallel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to find a way, last time I checked, it was messing the docker cli UI completly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah since, I changed, the output, it works!
@aluzzardi please take another look I updated with your suggestions |
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
done := make(chan bool, size) | ||
for _, n := range c.nodes { | ||
go func(nn *node) { | ||
callback(nn.Name(), "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you ensure the callback is not null before invoking it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will even though I don't think is is necessary. The function isn't called by the cluster driver implem, but by the swarm api. So we won't call it with nil.
Signed-off-by: Victor Vieux <vieux@docker.com>
@aluzzardi PTAL |
Add support for pull on all hosts (no change in docker run)
Wouldn't adding support for |
👍 |
Right now, we have an issue because when we do a docker run, the scheduler will select a node.
Then, if this node doesn't have the image already pulled, swarm will pull the image automatically.
We do that because there is no way to tell to the client to pull the missing image on a particular node.
One issue is: it doesn't work with private images, because swarm doesn't have the client credential.
With this PR, you are able to do a
docker pull
manually to pull an image on all the nodes, this works for private images.This PR also add a basic implementation of
docker rmi
anddocker inspect
for imagesThere is no change in the way docker run works.
then
docker pull rethinkdb ubuntu-2: Pulling downloaded... fedora-1: Pulling downloaded... ubuntu-1: Pulling downloaded... : rethinkdb:latest
then