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!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

    Einmal editiert, zuletzt von gderf ()

    • Offizieller Beitrag

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

  • 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 =

    2 Mal editiert, zuletzt von gett () aus folgendem Grund: Ansver to Agricola

  • 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

  • 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!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB 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 =

    • Offizieller Beitrag

    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.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!