docker.el
docker.el copied to clipboard
Support for multiple compose files
Hello @Silex,
I'm trying to run some docker compose files with the Compose option, but if I use the -f to select a compose file I don't see the option to add multiple files.
In my case now I have a docker-compose and a docker-compose.override file which both need to be used at the same time.
Is this possible with the current implementation?
With kind regards,
Maaroen
@maaroen: it's not supported directly but you can select one file then add the 2nd -f flag yourself.
So, in the popup you'd type "docker-compose.yml -f docker-compose.override" as the value for the -f flag.
@Silex ah ok I'll use that for now, but I think it would be a nice feature to add extra ones with an additional command.
Thanks for your fast reply!
@maaroen: with what interface tho?
@tarsius: do you have something in transient to input "multiple times the same flag"? Right now all I can suggest is the above.
The end command is cmd -f foo.yml -f bar.yml -f keke.yml.
EDIT: maybe some sort of read-file-name implementation wrapper that displays a prompt like select file (C-RET to enter another one, RET to finish) and then joins that list using -f .
@Silex, Or you could make a sub interface in the mean time in which you can keep pressing the same - f untill you added all you wanted. Like
Docker-mode > compose -Ff and then something which shows options to add additional files or ready and back to compose menu. Not sure if it is possible tho.
Or perhaps a dired (like) window in which you can mark the files you want?
Look at magit:--, which is used to pass a list of files to git log. Also look at the class of that: transient-files and in particular all the methods implemented for that class. You will likely have to create your own class and implement some of these generic functions slightly differently.
@tarsius: thanks! will do.
Is this discussion about
(docker-utils-transient-define-prefix docker-container-logs ()
"Transient for showing containers logs."
:man-page "docker-container-logs"
["Arguments"
("f" "Follow" "-f") ; <--------- this argument?
("s" "Since" "--since " read-string)
("t" "Tail" "--tail " read-string)
("u" "Until" "--until " read-string)]
[:description docker-utils-generic-actions-heading
("L" "Logs" docker-utils-generic-action-async)])
(If not, then please point me to the thing that needs to be improved.)
@tarsius: sorry, being a new father makes me really busy :sweat_smile:
This is about this https://github.com/Silex/docker.el/blob/master/docker-compose.el#L312:
(transient-define-prefix docker-compose ()
"Transient for docker-compose."
:man-page "docker-compose"
["Arguments"
("a" "No ANSI" "--no-ansi")
("c" "Compatibility" "--compatibility")
("d" "Project directory" "--project-directory " docker-compose-read-directory)
("f" "Compose file" "--file " docker-compose-read-compose-file) ; <------ THIS
("h" "Host" "--host " read-string)
("l" "Log level" "--log-level " docker-compose-read-log-level)
("p" "Project name" "--project-name " read-string)
("v" "Verbose" "--verbose")]
[["Images"
("B" "Build" docker-compose-build)
("F" "Pull" docker-compose-pull)
("P" "Push" docker-compose-push)]
["Containers"
("C" "Create" docker-compose-create)
("D" "Remove" docker-compose-rm)
("U" "Up" docker-compose-up)
("W" "Down" docker-compose-down)]
["State"
("O" "Stop" docker-compose-stop)
("S" "Start" docker-compose-start)
("T" "Restart" docker-compose-restart)]
["Other"
("R" "Run" docker-compose-run)
("L" "Logs" docker-compose-logs)
("E" "Exec" docker-compose-exec)
("V" "Config" docker-compose-config)]])
Basically, the resulting command can be (examples):
docker-compose run --rm someservice foobardocker-compose -f dev.yml run --rm someservice foobardocker-compose -f dev.yml -f with_env.yml run --rm someservice foobardocker-compose -f dev.yml -f another_env.yml -f production_mailer.yml run --rm someservice foobar
That is, the -f argument can go from 0 to N files, but in practice it's often 0/1 or 2. This argument is only for docker-compose and then the subcommand (run) takes other flags etc.
@noorul at the moment to use multiple compose file you press f then input foo.yml -f bar.yml.
I'm not sure it's even feasible as https://github.com/Silex/docker.el/blob/master/docker-compose.el#L317 doens't use read-string.
There's this discussion about how we'd support that at #169, but we basically wait on finding a transient way to do that.