You can generate a docker-compose yaml definition from a running docker container

Nice
https://github.com/red5d/docker-autocompose/pkgs/container/docker-autocompose
Can do multiple container per run

1 Like

That's cool. Thanks for sharing.

I was wondering if such feature existed.
No more wondering. :slightly_smiling_face:

I'm keeping it around. Nice tool.

# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose channels-dvr-pluto
services:
  channels-dvr-pluto:
    command:
      - "/bin/sh"
      - "-c"
      - "./run.sh"
    container_name: "channels-dvr-pluto"
    devices:
      - "/dev/dri:/dev/dri"
    entrypoint:
      - "/sbin/tini"
      - "--"
    environment:
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "CHANNELS_PORT=8489"
      - "TZ=America/Los_Angeles"
    hostname: "DS1019PLUS"
    image: "fancybits/channels-dvr:tve"
    ipc: "private"
    logging:
      driver: "db"
      options: {}
    network_mode: "host"
    restart: "unless-stopped"
    volumes:
      - "/volume1/ChDVRpluto:/shares/dvr"
      - "/volume1/arkives/importtest:/shares/imports:ro"
      - "/volume1/docker/channels-dvr-pluto:/channels-dvr"
version: "3.6"

And the source for that DVR container

# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose pluto-for-channels
networks:
  cdvr-net:
    external: true
    name: "cdvr-net"
services:
  pluto-for-channels:
    container_name: "pluto-for-channels"
    entrypoint:
      - "/usr/src/app/entrypoint.sh"
    environment:
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "NGINX_VERSION=1.18.0"
      - "NJS_VERSION=0.4.4"
      - "PKG_RELEASE=2"
      - "TZ=America/Los_Angeles"
      - "START=10000"
    hostname: "a78b52319c9f"
    image: "pluto-for-channels:my"
    ipc: "private"
    labels:
      maintainer: "Jon Maddox <[email protected]>"
    logging:
      driver: "db"
      options: {}
    networks:
      - "cdvr-net"
    ports:
      - "192.168.1.3:8080:80/tcp"
    restart: "unless-stopped"
    working_dir: "/usr/src/app"
version: "3.6"

Thanks for posting this. I've been hoping to stumble across something that would do this.