Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Run local built container on swarm #806

Closed
aanm opened this issue May 17, 2015 · 7 comments
Closed

Run local built container on swarm #806

aanm opened this issue May 17, 2015 · 7 comments

Comments

@aanm
Copy link

aanm commented May 17, 2015

I know this is probably something hard to do, but will (or is it right now?) be possible to run a docker image built on the host machine to be ran on a swarm machine? I just figure this out when I tried to run the simplest demo from compose and swarm, where one of the containers is built on my machine.

@aanm aanm changed the title Compose with Swarm Run local built container on swarm May 17, 2015
@aluzzardi
Copy link
Contributor

You can either:

@aanm
Copy link
Author

aanm commented May 17, 2015

@aluzzardi Where does swarm stores the image made by docker build? I mean, is it possible the built result would end up on a node and docker run will be addressed to a different node?

@aluzzardi
Copy link
Contributor

@aanm Yes, very likely. docker build uses the same scheduling as docker run, so it will end up on a machine depending of your filters and strategy. docker run will likely try to run on a different node.

Right now, you can solve this by using image affinities:

docker build -t foo .
docker run -e affinity:image==foo foo

The former will build an image on the cluster while the latter will schedule a run and force it to be on a machine that has the foo image.

#743 will do that for you automatically

@aluzzardi aluzzardi added this to the 0.4.0 milestone May 27, 2015
@jasw
Copy link

jasw commented Jun 4, 2015

Thanks, that helped me.

@aluzzardi
Copy link
Contributor

@aanm The affinity is not required anymore in master (and on the upcoming 0.4.0) thanks to a PR by @jimmyxian

@aanm
Copy link
Author

aanm commented Jul 30, 2015

@aluzzardi Thanks for the heads up! Can you tell me the PR number?

@aluzzardi
Copy link
Contributor

Proposal is #743 and implementation #971

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants