-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add script which runs Fig inside Docker #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| .git | ||
| venv |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/bash | ||
| # This is a script for running Compose inside a Docker container. It's handy for | ||
| # development. | ||
| # | ||
| # $ ln -s `pwd`/script/dev /usr/local/bin/docker-compose | ||
| # $ cd /a/compose/project | ||
| # $ docker-compose up | ||
| # | ||
|
|
||
| set -e | ||
|
|
||
| # Follow symbolic links | ||
| if [ -h "$0" ]; then | ||
| DIR=$(readlink "$0") | ||
| else | ||
| DIR=$0 | ||
| fi | ||
| DIR="$(dirname "$DIR")"/.. | ||
|
|
||
| docker build -t docker-compose $DIR | ||
| exec docker run -i -t -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:`pwd` -w `pwd` docker-compose $@ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't support alternative paths for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean? For Linux users and Mac folks using boot2docker, that's always going to be true. Arguably less certain in the case of remote servers and Swarm clusters, though.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this makes the assumption that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, actually, there's a PR to change that, apparently, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this is going to be correct most of the time. We actually use a different socket path in development environments by setting |
||
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.
So I guess the tradeoff here (vs using an official image that gets pulled on the first run) is that it's probably a bit faster the first run, but a bit slower on subsequent runs. Even with the cache, it's still going to take a second or two to run each time, right?
That seems ok for a first pass, but we should really consider moving to just pulling an image from the docker registry.
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.
Perhaps we should follow the same logic as
docker run: attempt to run, check for the "No such image" error, build the image and try again.For actual distribution, I agree - we should be pulling a tagged image from the registry.
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.
👍 and the image should just have the built binary in it. See: https://github.com/docker/swarm-library-image
This is just for development, however.