Skip to content

Conversation

bfirsh
Copy link

@bfirsh bfirsh commented Nov 5, 2014

Handy for development. Works something like this:

$ cd ../afigproject
$ ../fig/script/dev up

Maybe needs a better name? Should we update CONTRIBUTING.md?

@dnephin
Copy link

dnephin commented Nov 6, 2014

Seems reasonable to me. Maybe add these comments (usage and purpose) from the PR into the script as documentation?

@josephpage
Copy link

Running Fig inside Docker is also the only way to run fig on Windows. See #599
An official fig image should be more convenient for inclusion in boot2docker : boot2docker/boot2docker#603

@dnephin
Copy link

dnephin commented Nov 8, 2014

I also really like the idea of an official image for this. I believe we can add that as a step to the wercker build.

@josephpage
Copy link

@dnephin Great. I'm thinking about adding a "official-image" folder in the root of this repo with the Dockerfile of dduportal/fig image @dduportal :
https://registry.hub.docker.com/u/dduportal/fig/dockerfile/
https://github.com/dduportal/dockerfiles/tree/master/fig

Have you imagined something more minimalist ?

I can make the whole process, from writing README.md to submitting PR to docker-library/official-images.

@bfirsh
Copy link
Author

bfirsh commented Nov 18, 2014

@josephpage The official image should be the Dockerfile in the root of this repository. I think the only change that is needed is to have an entrypoint of fig and to update the test scripts that use that image to override the entrypoint. Then: docker run fig :)

@bfirsh
Copy link
Author

bfirsh commented Nov 18, 2014

Also: the official build should be stable versions, so Wercker doesn't need to do anything. Latest can point at the tag of the latest version on Git.

This kinda thing: https://github.com/docker-library/official-images/blob/master/library/crate

@thaJeztah
Copy link
Member

Then: docker run fig

Doesn't that require docker.sock to be mounted inside the container (or some other connection to the daemon)?

@bfirsh
Copy link
Author

bfirsh commented Nov 19, 2014

@thaJeztah Yep. Baby steps. ;)

@josephpage
Copy link

@bfirsh

I think the only change that is needed is to have an entrypoint of fig

It works, but the official image will contain unnecessary build dependencies.
I believe official images should be minimal.

@dduportal
Copy link

Hi all, there is an interesting discussion here :moby/moby#8637 .
This is the @aanand proposal for "docker groups", a.k.a. "fig in docker" as a core function of docker.

My thought is : Which energy should we spend to "perfectly Dockerize" fig in an official image, given that it should probably integrated as part of Docker in a near future ?

So on, the @josephpage proposal seems a good idea : his contribution to my image seems really lightweight and simple : from a debian:wheezy image, he just add the fig binary, re-using the description of an entrypoint to fig, making it really usefull for people coming from Windows world.

See boot2docker/boot2docker#603, boot2docker/boot2docker#603 or #599 for example => made me think that official image should be a good starting point for "now".

As addon about Dockerfile considerations, i personnaly use these guidelines :

It state some rules (not mandatory, but i really think its goods idea) to not embed dev. env inside production targeted container, which should be the case.
My proposal of contribution, as addon of @josephpage 's one (we'll group our works if OK) is to define to Dockerfile here :

  • One for developing/compiling fig a.k.a. "fig-dev" docker image
  • One for the "fig" in the Docker-spirit : make fig usage portable inside a container to not have dependency hell problem (yes we don't have to apt-get or something else when using fig, but the 32/64 bits problems of b2d, the non-compatibility of fig inside centos weeks ago, or the non compatibility today inside the busybox image are dependency-hell problems.).

Advices ?

@crosbymichael
Copy link
Contributor

@dduportal the links should be http not https, had to change some things around ,sry

@dduportal
Copy link

@crosbymichael Thanks for the fix ! Links edited in the comment !

@bfirsh
Copy link
Author

bfirsh commented Nov 20, 2014

Here we go: #661

@bfirsh bfirsh force-pushed the add-script-which-runs-fig-inside-docker branch from 678393f to 407124b Compare December 8, 2014 21:33
@bfirsh
Copy link
Author

bfirsh commented Dec 8, 2014

Rebased with #661.

@dnephin
Copy link

dnephin commented Dec 11, 2014

I think it could use a short comment explaining what it's for, otherwise LGTM

@thaJeztah
Copy link
Member

This needs to be rebased/re-branded. A request for a script like this just came up in IRC :)

@ewindisch
Copy link

I put this together back in June. It does docker-in-docker, but could be modified to also support being given a socket (it might already work, but I haven't tried it)

https://github.com/ewindisch/figleaf
https://registry.hub.docker.com/u/ewindisch/figleaf/

Usage is to add a 'fig.yml' file to the current context and create a Dockerfile. One could do, for instance:

$ touch fig.yml   # You'd want to put actual content in this...
$ docker build -t my-figged-image - <<<"FROM ewindisch/figleaf"
$ docker run --privileged my-figged-image

Another option would be to run figleaf directly:

$ touch fig.yml
$ docker run --privileged -v $PWD:/opt/figapp ewindsich/figleaf

@thaJeztah
Copy link
Member

Thanks for sharing, @ewindisch, will give it a spin when I get home.

@bfirsh bfirsh force-pushed the add-script-which-runs-fig-inside-docker branch from 407124b to de78137 Compare February 12, 2015 15:21
@bfirsh
Copy link
Author

bfirsh commented Feb 12, 2015

@aanand @dnephin Rebased and improved so it works as a symlink. :D

$ ln -s `pwd`/script/dev /usr/local/bin/docker-compose
$ cd /a/compose/project
$ docker-compose up

@bfirsh bfirsh force-pushed the add-script-which-runs-fig-inside-docker branch from de78137 to 69fb34e Compare February 12, 2015 15:39

set -e
DIR="$(dirname "$(readlink "$0")")"/..
docker build -t docker-compose $DIR
Copy link

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.

Copy link

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.

Copy link
Author

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.

@aanand
Copy link

aanand commented Feb 19, 2015

Seems to work well, except I had to remove the readlink for it to work - it was outputting an empty string. What purpose does it serve?

I'm concerned that you can't specify a docker-compose.yml path outside of the current directory. Perhaps we should mount /Users, just as boot2docker and Machine's VirtualBox driver do... or just document that if you're using a Compose file outside the current directory, you should docker run the image yourself and mount the right directory in.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
@bfirsh bfirsh force-pushed the add-script-which-runs-fig-inside-docker branch from 69fb34e to 0fa0131 Compare February 20, 2015 14:33
@bfirsh
Copy link
Author

bfirsh commented Feb 20, 2015

Oops, that's to follow symbolic links, but it doesn't work when it's not a link. Fixed.

@aanand
Copy link

aanand commented Feb 23, 2015

LGTM

aanand added a commit that referenced this pull request Feb 23, 2015
…docker

Add script which runs Fig inside Docker
@aanand aanand merged commit 1dd5ef4 into docker:master Feb 23, 2015
@lmakarov
Copy link

Is there anything else that prevents the official docker-compose docker image set up? If not, who can do that?

yuval-k pushed a commit to yuval-k/compose that referenced this pull request Apr 10, 2015
…nside-docker

Add script which runs Fig inside Docker
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants