Any way to create a docker-compose.yml from installed containers?

  • Hi,


    I have installed various containers via OMV Docker GUI. For learning, I wish to create docker-compose.yml for all installed containers. Is it possible?

    = Fujitsu PRIMERGY TX1310 M3 • 2 x HDD 3.5" 4TB Western Digital Red • Windows Server 2019 • Hyper-V • OMV 5.x =

  • I use autocompose occasionally. Below is the output when it was run against my running plex-linuxserver container.


    But I don't think Portainer will accept the default v3 output. Not sure if Portainer will accept v1 output which autocompose can be configured to provide.

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

    Edited once, last by gderf ().

    • Official Post

    Will a v.3 yml file run correctly from the command line?

    System Backup Typo alert: Under the Linux section the command should be sudo umount /dev/sda1 NOT sudo unmount /dev/sda1

    Backup Data Disk to Backup Disk on Same Machine: In a Scheduled Job:rsync -av --delete /srv/dev-disk-by-uuid-f8814ed9-9a5c-4e1c-8830-426968c20ea3/ /srv/dev-disk-by-uuid-e67439d5-00a3-4942-bd5f-b84ab86aa850/ Don't forget trailing slashes, and BE CAREFUL. (HT: Getting Started with OMV5)

    Equipment - Thinkserver TS140, NanoPi M4 (v.1), Odroid XU4 (Using DietPi): PiHole

  • Would be nice if you would share your experiences

    Sure. BTW, nice tool, thanks to pointing to it.


    First, it's working.


    Second, I think that it will be useful to share the process of installation for n00bs like me.


    1. Install git
    sudo apt update
    sudo apt install git


    2. Optional: change to your docker user folder (mine is "docker1")
    cd /home/docker1


    3. D/L repo (don't create special folder, git will do it for you)
    sudo git clone https://github.com/Red5d/docker-autocompose.git


    4. Cnange to created repo folder
    cd home/docker1/docker-autocompose


    5. Run
    sudo docker build -t red5d/docker-autocompose . (Don't miss dot at the end)


    6. Run
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose <container-name-or-id> <additional-names-or-ids>...


    6a. To find container IDs, run
    docker ps


    Output is in Docker v3 format, you should use -v 1 for version 1, have to check did -v 2 works for 2.0


    You have your docker-compose.yml for containers you include in command. :)


    EDIT


    Will a v.3 yml file run correctly from the command line?

    I am not sure, but I think not. But you can use -v 1


    EDIT: -v 1 or -v 2 option give me an error :(
    So, the output is ver 3

    = Fujitsu PRIMERGY TX1310 M3 • 2 x HDD 3.5" 4TB Western Digital Red • Windows Server 2019 • Hyper-V • OMV 5.x =

    Edited 2 times, last by gett: Ansver to Agricola ().

  • have to check did -v 2 works for 2.0

    Passing -v 2 gets you a version 3 file :(

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • Would be nice if you would share your experiences

    Sure. BTW, nice tool, thanks to pointing to it.


    First, it's working.


    Second, I think that it will be useful to share the process of installation for n00bs like me.


    1. Install git
    sudo apt update
    sudo apt install git


    2. Optional: change to your docker user folder (mine is "docker1")
    cd /home/docker1


    3. D/L repo (don't create special folder, git will do it for you)
    sudo git clone https://github.com/Red5d/docker-autocompose.git


    4. Cnange to created repo folder
    cd home/docker1/docker-autocompose


    5. Run
    sudo docker build -t red5d/docker-autocompose .


    6. Run
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose <container-name-or-id> <additional-names-or-ids>...


    6a. To find container IDs, run
    docker ps


    7. run
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose <container-name-or-id> <additional-names-or-ids>...


    Output is in Docker v3 format, you should use -v 1 for version 1, have to check did -v 2 works for 2.0


    You have your docker-compose.yml for containers you include in command. :)

    Will a v.3 yml file run correctly from the command line?

    I am not sure, but I think not. But you can use -v 1

    Passing -v 2 gets you a version 3 file

    Well that sucks. :(

    = Fujitsu PRIMERGY TX1310 M3 • 2 x HDD 3.5" 4TB Western Digital Red • Windows Server 2019 • Hyper-V • OMV 5.x =

  • Hi,


    This is cool. I’m try to save my containers configs in a docker compose file too.


    For step 6, I can run for more than one container at at time, right ?



    Thanks for sharing.

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

  • Where is the output file?

    If you don't direct the autocompose output to a file, then the output is on the console.

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • Ok. I did.


    it worked with id not with the names. mine was...


    sudo docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose e37ff95aeb82 1d4e492180da bc4df6728661 dc9e09f3b80f 765dd33b34ba 38222d1446fe

  • This works for me:


    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose sonarr


    or with any other running container_name

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • hi,


    so just for me (ok maybe someone else too) what is the problem if the file is v3 and not v2? in portainer can only v2 be loaded?
    but i can just run the v3 file in cli and its set up and appear in portainer as well?


    thx

    ___________________________
    OMV5@AsRock j3455 8GB RAM

  • ok, but, how often you need the compose files, for me it would be for migrations - so just take your compose files as a "snapshoot" move to the new maschine - run once and here we go.


    until know i only have one compose file - thats the nextcloud letsencrypt one wat i extend to onlyoffice and it runes 2 times until know (one time for nextcloud, the second to add onlyoffice) so i think it dosn't realy matter if v2 or v3. correct me if i didn't see anything here ;)

    ___________________________
    OMV5@AsRock j3455 8GB RAM

  • how often you need the compose files

    When I created a post, I want to reinstall my OMV 4 server and install OMV 5. I need yml files for backup purposes. At the end, I start from scratch. But anyway, it's nice backup opportunity to have your yml files somewhere, just to reduce typing


    I am old copy-paste guy :)

    = Fujitsu PRIMERGY TX1310 M3 • 2 x HDD 3.5" 4TB Western Digital Red • Windows Server 2019 • Hyper-V • OMV 5.x =

    • Official Post

    When I created a post, I want to reinstall my OMV 4 server and install OMV 5. I need yml files for backup purposes. At the end, I start from scratch. But anyway, it's nice backup opportunity to have your yml files somewhere, just to reduce typing
    I am old copy-paste guy :)

    Although I made mine manually... I've got about 15 docker-compose files for this exact reason.


    When I did a reinstall, I had my server back up in no time flat. If you use filesystem labels, and use those labels consistently, you can even use the compose file to deploy across other servers with very little fuss.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!