Skip to content

Can fig build an image with no service/container associated ? #663

Closed

Description

@dridi

I'm just starting with fig so it may just be a case of not reading properly the docs, but I haven't found out how to just build an image with fig. I'm trying to replace a make-based approach after someone told me a couple months ago that I was basically doing what fig does. I was also waiting for fig 1.0 to land in Fedora, which is almost there.

But I have a base image, which is basically based on centos:centos6, installs and enables EPEL, and a private YUM repository. I use this image as a base for all the containers, and incidentally benefit from caching and DRY.

Conceptually, it looks a bit like this:

find . -name Dockerfile
./base/Dockerfile
./db/Dockerfile
./front/Dockerfile

Now I can create and run db and front containers, and link them together, but I have built the base image separately. There is no base container.

Did I miss something?

Activity

  1. aanand commented on Nov 21, 2014

    @aanand

    If there's a base container defined in fig.yml, it should definitely have been created. So:

    • Have you defined a base container in fig.yml? (if possible, could you paste the whole file here?)
    • If so, what's the output of docker ps -a?
  2. dridi commented on Nov 21, 2014

    @dridi
    Author

    There is no base container, the base image contains the common bits for all other images. It is not meant to run anything by itself.

    I build the base image using: docker build -t stuff/base base.

    The other images' Dockerfiles start with FROM stuff/base.

  3. aanand commented on Nov 21, 2014

    @aanand

    Sorry, I originally read "There is no base container" as your description of the problem :)

    If I have it right, you're not actually trying to run your containers, just build the images for them. If so, whoever told you that was Fig's job was mistaken - Fig is for running containers, and the image-building functionality only goes far as it needs to in order to enable that.

  4. dridi commented on Nov 21, 2014

    @dridi
    Author

    He was not mistaken, he told me I could use fig to manage containers in a declarative way instead of my make-based approach. And it works well!

    So I guess I have my answer, fig can't build arbitrary images and handle dependencies between such images and container images. Am I right?

  5. aanand commented on Nov 23, 2014

    @aanand

    That's right. There's talk about enabling that at the Docker level - see moby/moby#735 - but I don't really think it's Fig's job.

  6. fruch commented on Apr 14, 2015

    @fruch

    @DarkerMatter
    +1 for the hack of using /bin/true
    (but why does the app1 links django ?, it's a mistake ?)

  7. fruch commented on Apr 14, 2015

    @fruch

    @aanand
    look at:
    https://github.com/michaelsauter/crane
    the provision command, can do that
    I've seen people build up complex hierarchy of dockerfiles like that.

    Yes using a private docker-registry might be more advisable solution, but I think this kind of pattern can have it's place
    For it's lighter cases, or as a preparation stage to get the feeling of how the structure should look like before setting up registry with version and tags, and the whole shebang.

  8. dnephin commented on Sep 18, 2015

    @dnephin

    Related to #295, #610, #583

  9. dminkovsky commented on Sep 23, 2016

    @dminkovsky

    @dridi did you ever solve this? Specifically:

    I build the base image using: docker build -t stuff/base base.

    The other images' Dockerfiles start with FROM stuff/base.

  10. dridi commented on Sep 23, 2016

    @dridi
    Author

    From what I can remember from two-ish years ago, I tried to hack on fig to add a way to express dependencies between images but didn't manage to reliably do it because there were too many moving parts. Building the dependency graph by reading the FROM clause of the Dockerfiles was also feeling somewhat wrong.

    Then my use case retired. By the time I was done with it my Makefile had been good-enough and I moved on to other work.

    Looking at @DarkerMatter's workaround, it could work and help create the base image at the expense of creating a throwaway container. I'm not sure it would guarantee the image creation order. I haven't tried.

    Sorry

  11. dminkovsky commented on Sep 23, 2016

    @dminkovsky

    @dridi I figured this was long ago, far away for you at this point :). Yeah, I just have a shell script that builds these base images. Definitely good enough.

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions