Skip to content
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

Proposal: Don't build images #1455

Closed
dnephin opened this issue May 24, 2015 · 22 comments
Closed

Proposal: Don't build images #1455

dnephin opened this issue May 24, 2015 · 22 comments

Comments

@dnephin
Copy link

dnephin commented May 24, 2015

An even more aggressive step from #693, compose could entirely remove the ability to build images.

Rational: If compose is a tool for composing services, the process of building images for those services is distinct from the concerns of running services.

The docker images already provides a great interface for separating these concerns. The existing compose support for building an image is pretty primitive, and could be easily replaced.

There are many different build scenarios, each of which could be handled by a separate tool:

Some of these problems are already solved by existing build tools:

Backwards Compatibility

In order to preserve some form of backwards compatibility we could:

  • in one release, warn if a build tag exists, and continue to build images
  • in the next release
    • allow both build and image keys for a service
    • ignore build and dockerfile keys
    • provide a new command to build images in the way that compose does now (based on the same config)
  • finally in some future release remove the build and dockerfile fields, and require a separate config for building images. Initially that config might be in a similar format, but likely it would evolve to support many of the scenarios described above
@kojiromike
Copy link

I like the UNIX thinking behind this proposal, but I'm having a hard time envisioning it as anything other than a burden without some examples of how it would work.

  1. Compose files are very static (even with extends). Injecting dynamic image names is a chore. Worse if you have many dynamic images.
  2. Compose doesn't currently accept image ids. If you don't use build, you have to name the image. But it's not always appropriate to name an image at all.

@dnephin
Copy link
Author

dnephin commented May 26, 2015

I agree that supporting image names and tags from environment variables would have to be supported before we were to do anything like this.

Compose does accept image ids (it was broken for a release, but I think the fix is in 1.3.0). I don't think that naming an image is a huge burden, but with environment variable support, using image ids should work as well.

@aanand
Copy link

aanand commented May 27, 2015

It's definitely true that building images is complicated, that Compose's primary job is orchestration and not building, and that the Docker image is the natural place to draw that line.

Swarm has already drawn that line by not supporting building at all, and down the line it's likely that building will be moved out of even the Docker daemon, to become a client-side process which just performs create/start/commit calls against the API.

Still - alongside everything else, Compose remains a tool for development environments, and having a simplistic build option serves the 80% "git clone, docker-compose up" case very well, so I'm reluctant to let go of it. It might be worth trying this docs-first, rewriting one or two of the tutorials without build and see how they look - but even then, we're examining ultra-simple one-build scenarios.

In any case, when it comes to the multitude of use cases you've linked to where Compose falls short, we might do well to recommend tools or approaches in the documentation (I suspect a Makefile would serve a lot of them).

@prologic
Copy link

I kind of don't mind having build removed either. To be honest I don't use it all that much. I typically use docker-compose to "compose" services and really use it as my "deployment" tool.

@thaJeztah
Copy link
Member

I'm still on the fence on this one. On one hand, it makes sense to make docker-compose only "orchestrate". On the other hand, having a single configuration file that defines which Dockerfiles have to be built for each service and which context to use for them, is really convenient.

Basically, it allows one to describe the whole "stack" in a single file, and just looking at the file describes what the project looks like.

@prologic
Copy link

I guess it is nice and convenient to do (in development) dc up (my alias for docker-compose) which used ot be fig up with a bunch of build: ... stanzas.

Problem is from a philosophical point of view; I don't really find myself doing this that often and could live with splitting this "workflow" out to a searpate "integration" and "testing" phase where I can build up the whole "stack"; but the parts are built individually.

@thaJeztah
Copy link
Member

Perhaps docker-compose should have some "hooks" that can trigger external tooling. (Really thinking out loud here)

@prologic
Copy link

TBQH though; I am kind of torn over this. Whilst I don't use the build feature of docker-compose myself that much it can still be nonetheless useful in some situations and for others :)

@funkyfuture
Copy link

i like the idea of dropping the build-, and consequently the pull-command. in order to make these a convenience in every situation would require a blow-up of the configuration options.

Perhaps docker-compose should have some "hooks" that can trigger external tooling. (Really thinking out loud here)

word. just let users place an executable _pre-up in a project-dir and let 'em bear the responsibility for what's goin' on there.

@kojiromike
Copy link

just let users place an executable _pre-up in a project-dir

Environment variables, please! :)

COMPOSE_PRE_UP_HOOK?

@funkyfuture
Copy link

that's what i mean. scripts can access environment and write env-files or manipulate a project-configuration.

@diginc
Copy link

diginc commented Jun 10, 2015

I use build and Dockerfiles which are FROM the public registry to handle customizing package sources and proxy stuffs, it is useful.

@josephpage
Copy link

From its origin, fig was a tool for development environnement, and still today it's the only (and the best !) CLI tool for that purpose.

Because I uses docker-compose intensively for development, I don't agree with @dnephin that compose is a only tool for composing services.
Kubernetes is for composing services in QA/production environnement and managing them.
But docker-compose is for launching lightweight stacks for dev/QA or even non-critical production quickly.

In my dreams, only git clone + docker-compose up [-d] should be required to start coding and live-testing a project.

Building an image is one of the basic steps to learn Docker
Building an image is the first step of developing with Docker.
Building an image is one essential part of the fig up's magic !

@kojiromike
Copy link

I essentially agree with @josephpage on this: If a tool like docker-compose is not going to be able to build directly anymore, then another tool must fill this gap – I need to be able to deliver a development environment with my code and have a single command for developers to get going on it. I have been able to do that with fig and compose, but am concerned about losing that ability.

@ghost
Copy link

ghost commented Jul 5, 2015

I entirely rely on "docker build" finding out what needs to be built from my docker-compose.yml file, so if that was removed that would greatly disrupt my workflow.

@dnephin
Copy link
Author

dnephin commented Aug 21, 2015

Another argument for removing build and dockerfile is that it's quite confusing for new developers coming to docker and compose (#1901 is just one example, but there are a few every week).

Have a config where 2 fields apply to one operation, and the other 20+ fields apply to a completely different operation isn't very intuitive.

@ghost
Copy link

ghost commented Aug 22, 2015

Again I would highly suggest just removing the implicit build triggered by docker-compose up instead which is the main source of confusion. (also the issue you linked doesn't seem to be specific to docker-compose's build.)

Docker compose is right now a nice tool to manage all around my docker image groups which pretty much covers everything needed. While the build support is primitive, it still saves time and makes it easier to manage the whole thing including the necessary build step in one simple tool.

One important point why docker-compose should cover everything and not just the running non-build functionality is that the docker-compose.yml contains information how the images will be named as well. If you remove basic functionality from docker compose to limit its scope, you will force people to parse docker-compose.yml manually with other tools to get that information, or force people to have yet another configuration file lying around which holds it instead. That seems like a nonsensical idea to me.

@kojiromike
Copy link

👍 to @Jonast 's idea.

@jayfk
Copy link

jayfk commented Sep 25, 2015

👎

@michaeljs1990
Copy link

I think you will see a hard fork of this project if this happens as it completely destroys the use of it in development.

@dnephin
Copy link
Author

dnephin commented Dec 4, 2015

I think it's clear that until we have another tool that would replace the build configuration we won't be removing build from compose. I think it's still important to remember that building images isn't the primary focus of compose, so not every feature request for building images in different ways is going to be supported.

@dnephin dnephin closed this as completed Dec 4, 2015
@ghost
Copy link

ghost commented Sep 26, 2016

I think it's still important to remember that building images isn't the primary focus of compose, so not every feature request for building images in different ways is going to be supported.

While that makes a lot of sense, this isn't much of a feature request but more a suggestion for a simple trivial change for a user experience problem. Lack of features is very reasonable if something isn't your main area, but that doesn't mean the ones that are present couldn't be optimized a bit when the user experience is too confusing.

However, as I stated above I think removing build isn't such a good idea, so I don't really mind this being closed. But I suggest to consider making up not implicitly build the container for a more coherent experience.

(unless this was already solved by some other change, e.g. building with every up or something similar)

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

No branches or pull requests

10 participants