Red5d / docker-autocompose

Generate a docker-compose yaml definition from a running container
1.76k stars 197 forks source link

An all argument to make listing all containers easier #28

Closed fryfrog closed 1 year ago

fryfrog commented 2 years ago

It'd be kind of useful if there was an all argument one could pass instead of individual container names. Would be a little bit of a time saver where we use this to help support people w/ Docker issues. :)

inovision commented 2 years ago

In the meantime: python autocompose.py $(docker ps -a | awk '(NR>1) {print $1}') > my_containers.yaml

maxcanna commented 2 years ago

In the meantime: python autocompose.py $(docker ps -a | awk '(NR>1) {print $1}') > my_containers.yaml

you can use docker ps -q in order to get just the ids. Something like

docker ps -q | xargs docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose
mattbab commented 2 years ago

This would ideally be the default behavior since the empty compose file generated isn't very useful at all.

hgghyxo commented 2 years ago

for a single one-liner:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose $(docker ps -aq)
maxcanna commented 1 year ago

Using the new flag causes the temporary container itself to be present in the output