Noob question: I’ve got a bunch of existing docker containers created with ‘docker run’. Is it possible for me to output my container settings for a ‘docker-compose yml’ file?

Hi everyone. I'm pretty new to docker, so I'm sorry if this is a stupid question. I tried a google and reddit search before posting.

Current Setup

  • Docker version 18.09.6, build 8cdf373 (on a Synology DS918+ DSM 6.2)
  • Containers managed from CLI, Portainer, or Synology's Docker GUI
  • About 20 containers for various things like networking (Pi-Hole), media (Tautulli), etc.

I created these containers all using docker run rather than a docker-compose command. I'm using non-default ports with mapped persistent folders and environmental variables.

For two reasons, I'd like to switch to a docker-compose *.yml format

  1. Ease of migration to another system
  2. Spinning up and shutting down multiple containers with a single command / Portainer click / on schedule

Right now, I'm using a round-about way of acomplishing #2. I've got a bash script that executes multiple docker start [Container Name] commands. It works, but I know it's not the 'right way' to do things

I could manually type out a docker compose file with all of my container settings, but that would take a bit of time.

Is there a faster way to do this?

submitted by /u/z3roTO60
[link] [comments]
Source: Reddit