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

The project name should be configurable #45

Closed
bfirsh opened this issue Jan 22, 2014 · 55 comments
Closed

The project name should be configurable #45

bfirsh opened this issue Jan 22, 2014 · 55 comments

Comments

@bfirsh
Copy link

bfirsh commented Jan 22, 2014

Ideally in fig.yml (how do we have general config in there? maybe we need a top level services key?), but maybe in a separate .fig-project file or something.

@aanand
Copy link

aanand commented Jan 22, 2014

I don't want to give up top-level services without a fight. Perhaps everything other than service configuration could go in a top-level key with a special name:

PROJECT:
  name: myapp

web:
  ...

db:
  ...

@bfirsh
Copy link
Author

bfirsh commented Jan 22, 2014

.project:
  name: myapp

web:
  ...

db:
  ...

maybe

@bfirsh
Copy link
Author

bfirsh commented Jan 22, 2014

or maybe services is a reserved service name and you can either do

name: myapp
services:
  web:
    ...

  db:
    ...

or

web:
  ...

db:
  ...

depending on whether you need extra config. But that's a bit gross.

I think I quite like the idea of adding a top-level "services" key.

@sherzberg
Copy link

+1 on a special key like @aanand mentioned. I would like to do global environment variables here too :)

@djmaze
Copy link

djmaze commented Feb 10, 2014

+1 for top-level name and services keys. You could just make a new major release so backwards compatibility is not mandatory ;)

I also like the idea of global environment variables. So you could e.g. give credentials to a database container (for setting up the database & user) as well as all consuming services. Those would be defined in a top-level environment entry.

@thaJeztah
Copy link
Member

Being able to specify the project-name manually (and not rely on the name of the directory) is quite important;

  • using our standard project-structure, the most logical location for the fig-file to resort in will be named the same for all our projects.
  • we're planning on using a shared docker host for our developers to work on. Multiple developers will work on their own instance of a project, so they should be able to provide a unique name for their instance of the project.

besides being able to specify the project-name inside fig.yml, fig should also take a parameter to override this, e.g. fig up -d --project-name=${USER}-my-project

@thomasf
Copy link

thomasf commented Aug 17, 2014

An alternative solution to having a special global key is to support two streams in fig.yaml.

Something like this:

project-name: something
---

db: 
  ...

app:
 ...

It might not be a good idea to attach semantics to location in the stream, I just wanted to throw it in the suggestion bowl.

@dnephin
Copy link

dnephin commented Aug 18, 2014

+1 for a single special key for non-service or "meta" stuff. This also came up in #210, and will be necessary for #318.

@dnephin
Copy link

dnephin commented Aug 18, 2014

@thomasf I'm not sure how many yaml parses support multiple streams. I tried it out with pyyaml and I got ComposerError: expected a single document in the stream.

@thomasf
Copy link

thomasf commented Aug 18, 2014

Its supported according to the docs by using load_all

http://pyyaml.org/wiki/PyYAMLDocumentation#LoadingYAML

@shuron
Copy link

shuron commented Aug 31, 2014

What about several (related) projects in one fig.yml?
I wan't to manage them all in one fig. Cause to me fig define something like everything on one host or vm. So some kine of basic namespacing should be here. At least i wanna have a possibility to give containers custom names. ( run --name=custom).

dnephin added a commit to dnephin/compose that referenced this issue Sep 1, 2014
dnephin added a commit to dnephin/compose that referenced this issue Sep 2, 2014
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
dnephin added a commit to dnephin/compose that referenced this issue Sep 13, 2014
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
dnephin added a commit to dnephin/compose that referenced this issue Sep 13, 2014
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
@dnephin
Copy link

dnephin commented Nov 8, 2014

@aanand do you see the group.yml format in https://gist.github.com/aanand/9e7ac7185ffd64c1a91a changing much?

I'd like to add support for that format to fig so that users can migrate to the new format ahead of any docker release with this support (to make the transition smoother). That change should also resolve this issue.

If you think it's still likely to change, I can hold off until it's more stable.

@aanand
Copy link

aanand commented Nov 10, 2014

@dnephin It should be considered unstable, so no adding support just yet. Input appreciated on the format itself - I'm actually somewhat unconvinced about putting the group name in the file, because it makes the whole thing less portable. Perhaps it should go in a separate, unversioned file.

@jderusse
Copy link

Could works... until you manage dozen of projects

@koddo
Copy link

koddo commented Aug 26, 2015

jderusse, I would write a line to make it take the project name from something like ./docker-compose-project-name. Just a quick and dirty fix until the option we all ask for is added eventually.

@koddo
Copy link

koddo commented Aug 26, 2015

What about this?

#!/usr/bin/env bash

PRJ=$(head -n 1 ./docker-compose-project-name)
docker-compose --project-name "$PRJ" "$@"

@neilsarkar
Copy link

+1

@tkuben
Copy link

tkuben commented Sep 11, 2015

Any update on this? I would like a way to name the final image either via command line or via yml file.

@dnephin
Copy link

dnephin commented Sep 11, 2015

The project name is already configurable from command line or environment variable (-p or COMPOSE_PROJECT_NAME)

@DrMeers
Copy link

DrMeers commented Sep 14, 2015

Yes but it makes sense to allow the project name to be configured in the config file to avoid having to set it on the command line or environment?

@bachi76
Copy link

bachi76 commented Sep 17, 2015

+1

@ChrisPearce
Copy link

+1 for being able to set this in the docker-compose.yml file

@alekbarszczewski
Copy link

+1

@dnephin
Copy link

dnephin commented Oct 19, 2015

Let's continue this in #745. The project name is configurable, now we just need a persistent configuration.

@dnephin dnephin closed this as completed Oct 19, 2015
@wcarmon
Copy link

wcarmon commented Jul 28, 2016

+2

@temirov
Copy link

temirov commented Oct 10, 2016

👍

1 similar comment
@kenylieou
Copy link

+1

@MadWombat
Copy link

+1 maybe make it version: "3" or something

@droidlabour
Copy link

+1

@jpringle03
Copy link

+1 I would definitely love to see this.

@deiucanta
Copy link

+1

5 similar comments
@eugenesia
Copy link

+1

@edrzmr
Copy link

edrzmr commented Feb 14, 2017

+1

@ameoba32
Copy link

+1

@igor-lemon
Copy link

+1

@vimalloc
Copy link

vimalloc commented Mar 4, 2017

+1

@igor-lemon
Copy link

Right now we can use .env file with custom project name and set
COMPOSE_PROJECT_NAME=SOMEPROJECTNAME
It's not flexible but it's better than nothing.

@richardbrinkman
Copy link

+1

2 similar comments
@phoenixsampras
Copy link

+1

@jmthvt
Copy link

jmthvt commented Nov 29, 2017

+1

@thaJeztah
Copy link
Member

I'm locking the conversation on this issue; the -p / --project-name and COMPOSE_PROJECT_NAME options have been implemented over two years ago, and a follow-up discussion can be found in #745

@docker docker locked and limited conversation to collaborators Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.