-
Notifications
You must be signed in to change notification settings - Fork 644
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
Name container by default with Image alias when starting container #48
Comments
so i'm just going to pick the discussion up here... what happens if i have multiple aliases defined w/in the 'images' configuration, which one gets used? i'm also not sure i would want the name to 'auto increment' if a container with the same name is running. personally, i would want that to be an error so perhaps that could be an option in the configuration. |
Each
Since for each image one container is started, there can be no clash among the aliases. If no alias is provided, the container wouldn't get a custom name. Advantage of the auto increment would be that you could still run an integration ( An alternative would be to not give the containers a name when there is already a container with this name. But a global option would be probably ok, too. What's about having a
? |
yeah - i was thinking about this from the standpoint of using the data container and now i realize that the above solution works, i just need to change how i name the aliases for each of the images. i'm starting to wonder if it would be better to create deploy/undeploy goals for this instead of cramming it into the existing start/stop goals. obviously there is some overlap in functionality but that seems like it would offer more flexibility and avoid the need to do the |
I wouldn't want to have extra goals for this particular use case (also But you can always overwrite the configured with
Maybe
Hmm, don't find a better and shorter name (don't like my suggestions above because they are to generic) |
i'm considering i still think having separate goals for this use case should be ruled out. in my case, the docker instance i am going to be deploying to is different then the docker instance i build/test against which means i need to be able to specify a different host which is somewhat cumbersome on the command line, but having a deploy goal means i could have some xml configuration that would allow me to define that host separately. |
Sorry, I didn't get that. You want to connect different images for different environments (dev/test) ? Beside the fact, that I think that your approach (if I understand it right) discards a lot of the benefits that Docker can deliver (namely immutable servers which you pump through the continuous delivery pipeline as a whole with the server image being the same everywhere) you always can use different Maven profiles for different configurations and select your profile on the command line. Or do you mean that you want to start/stop on different Docker Hosts (configuration Either way, introducing a new goal only for having different configurations is not the right way (goals are really heavy weight and must not overlap). Another approach commonly seen is, that you BTW, I just see that I'm using camel case for the config, so |
i want to be able to build the docker container on a build box, push it to my local registry, and then issue a command to the production server to stop the old image and pull/start the new one. i felt having separate goals for this would make the implementation simpler b/c you could do away w/ all the different naming scheme logic. either you get a random name or the name defined in the pom. if you want to deploy two instances for whatever reason and defined a name in the pom, you need to use a as i said, your project, your rules so i'll see about making modifications to the start goal. :) |
i have a basic implementation of this working but it requires the open pull requests for #108 to be merged first as it's built on top of that. this is what the config looks like <image>
<name>busybox:latest</name>
<alias>issue-48-named</alias>
<namingScheme>alias</namingScheme>
<run>
<command>ping google.com</command>
</run>
</image>
this resolves the use case i need to satisfy right now and the flexibility is there for more naming schemes to be added at a later date if the demand is there but for now i don't see the need. open to suggestions if you don't like |
this is ready to go pending the complete of the outstanding pull requests and any changes i need to sync w/ as a result. i moved the <image>
<name>busybox:latest</name>
<alias>issue-48-named</alias>
<run>
<command>ping google.com</command>
<namingScheme>alias</namingScheme>
</run>
</image> it would be super great if |
I'm halfway through the PRs and try my very best to release this weekend ;) |
cool - i just didn't want to overwhelm you anymore then i did w/ changes stacked on changed. as soon as #110 goes in i'll sync on my end and create this PR. |
- allow container to be named using `alias` when created/started Signed-off-by: Jae Gangemi <jgangemi@gmail.com>
"Strategy" seems to be more appropriate than "scheme" since it is really more about how to name the container. #48
Fixed in 0.11.3 |
If an image has an
<alias>
, the container created duringdocker:start
should be named with the alias. If already a container with name exists, then a suffix should be added until the name is unique. E.g. if the aliasdb
is alread taken, trydb_1
,db_2
, .... until a free name is found.See #35 for a discussion about this.
The text was updated successfully, but these errors were encountered: