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

    • OMV 4.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

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

      Source Code

      1. version: "3"
      2. services:
      3. plex-linuxserver:
      4. cap_add:
      5. - AUDIT_WRITE
      6. - CHOWN
      7. - DAC_OVERRIDE
      8. - FOWNER
      9. - FSETID
      10. - KILL
      11. - MKNOD
      12. - NET_BIND_SERVICE
      13. - NET_RAW
      14. - SETFCAP
      15. - SETGID
      16. - SETPCAP
      17. - SETUID
      18. - SYS_CHROOT
      19. cap_drop:
      20. - AUDIT_CONTROL
      21. - BLOCK_SUSPEND
      22. - DAC_READ_SEARCH
      23. - IPC_LOCK
      24. - IPC_OWNER
      25. - LEASE
      26. - LINUX_IMMUTABLE
      27. - MAC_ADMIN
      28. - MAC_OVERRIDE
      29. - NET_ADMIN
      30. - NET_BROADCAST
      31. - SYSLOG
      32. - SYS_ADMIN
      33. - SYS_BOOT
      34. - SYS_MODULE
      35. - SYS_NICE
      36. - SYS_PACCT
      37. - SYS_PTRACE
      38. - SYS_RAWIO
      39. - SYS_RESOURCE
      40. - SYS_TIME
      41. - SYS_TTY_CONFIG
      42. - WAKE_ALARM
      43. container_name: plex-linuxserver
      44. entrypoint:
      45. - /init
      46. environment:
      47. - TZ=America/New_York
      48. - VERSION=latest
      49. - PGID=100
      50. - PUID=1001
      51. - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      52. - HOME=/root
      53. - LANGUAGE=en_US.UTF-8
      54. - LANG=en_US.UTF-8
      55. - TERM=xterm
      56. - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility
      57. - DEBIAN_FRONTEND=noninteractive
      58. - PLEX_DOWNLOAD=https://downloads.plex.tv/plex-media-server-new
      59. - PLEX_ARCH=amd64
      60. - 'PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/config/Library/Application Support'
      61. - PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
      62. - PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
      63. - PLEX_MEDIA_SERVER_USER=abc
      64. - PLEX_MEDIA_SERVER_INFO_VENDOR=Docker
      65. - 'PLEX_MEDIA_SERVER_INFO_DEVICE=Docker Container (LinuxServer.io)'
      66. expose:
      67. - 1900/udp
      68. - 3005/tcp
      69. - 32400/tcp
      70. - 32410/udp
      71. - 32412/udp
      72. - 32413/udp
      73. - 32414/udp
      74. - 32469/tcp
      75. - 8324/tcp
      76. hostname: omv
      77. image: linuxserver/plex:latest
      78. ipc: shareable
      79. labels:
      80. build_version: 'Linuxserver.io version:- 1.18.4.2171-ac2afe5f8-ls74 Build-date:-
      81. 2020-01-16T00:53:03-05:00'
      82. maintainer: thelamer
      83. logging:
      84. driver: json-file
      85. options: {}
      86. networks:
      87. host:
      88. aliases:
      89. restart: unless-stopped
      90. volumes:
      91. - /srv/dev-disk-by-label-d0/plexmediaserver-database:/config
      92. - /srv/dev-disk-by-label-d1/sftp/outgoing/movies:/data/movies
      93. - /srv/dev-disk-by-label-d1/sftp/outgoing/music:/data/music
      94. - /srv/dev-disk-by-label-d1/sftp/outgoing/tv-series:/data/tv-series
      95. - /etc/localtime:/etc/localtime:ro
      96. - /srv/dev-disk-by-label-d0/plexmediaserver-transcode:/transcode
      97. networks:
      98. host:
      99. external: true
      Display All
      --
      Google is your friend and Bob's your uncle!

      RAID - Its ability to disappoint is inversely proportional to the user's understanding of it.

      ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.

      The post was edited 1 time, last by gderf ().

    • macom wrote:

      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

      Agricola wrote:

      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

      The post was edited 2 times, last by gett: Ansver to Agricola ().

    • macom wrote:

      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. :)

      Agricola wrote:

      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

      gderf wrote:

      Passing -v 2 gets you a version 3 file
      Well that sucks. :(
    • 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!

      RAID - Its ability to disappoint is inversely proportional to the user's understanding of it.

      ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.
    • 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
    • gett wrote:

      draddy wrote:

      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 :)
      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.
      Air Conditioners are a lot like PC's... They work great until you open Windows.