Red5d / docker-autocompose

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

Best way to send output to a file? #55

Closed jtjh closed 1 year ago

jtjh commented 1 year ago

Just been tinkering with this, obv can't just append tee or > to the end of the docker command and something like |& > output.txt does not work.

What is the best option here?

dhumphrey7 commented 1 year ago

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose container _name > container_name.yml worked for me. Since the run command just outputs the results to the screen you are able to append that to a file.

Red5d commented 1 year ago

As @dhumphrey7 mentioned, appending "> container_name.yml" to the end of the docker run command does actually work and is the best way to output directly to a file.