Commit Graph

28 Commits

Author SHA1 Message Date
Konstantin Köhring
d07ce54dd0 Quote all string values to reduce probability of compose syntax errors (#51)
* Fix a bug where strings with special characters are not quoted

Before:
```
...
services:
  <service>:
    ....
    logging:
      options:
        tag: {{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}
        max-file: 3
    ...
```
and docker-compose up fails
after:
```
...
services:
  <service>:
    ....
    logging:
      options:
        tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
        max-file: "3"
    ...
```
and docker-compose up works

* Remove no longer necessary workarounds
2022-11-14 01:07:13 -05:00
Juan Biondi
0aa4522143 Fix issue on index out of error (#54)
* Add gather info about all networks in the system.

* Only generate host networks if all info is required.

* Fix issue getting network information.

Co-authored-by: Juan Biondi <juan@payslip.com>
2022-11-07 15:00:39 -05:00
Juan Biondi
dea3d848e8 Add gather info about all networks in the system. (#53)
* Add gather info about all networks in the system.

* Only generate host networks if all info is required.

Co-authored-by: Juan Biondi <juan@payslip.com>
2022-11-02 16:39:39 -04:00
Red5d
dfc73d0bbd Update compose version 3 to 3.6.
With somewhat-recent docker features and spec changes that have been included in the compose file generation for this script, specifying compose file version 3.6 (at least) is necessary for the output compose file to pass validation using "docker-compose config".
2022-08-20 14:39:29 -04:00
Red5d
1768a65fce Fixes the --all option, volumes of type 'bind' and read only option (#46)
(from @d-EScape)

One PR that includes my suggestions for #17 and some new ones:

The -all option would not work because every iteration of container_names could set the 'networks' and 'volumes' to None. Even if a previous container had a network. Later iterations could not add a network, because it was no longer a dict, resulting in an exception.

The code might need some cleaning up. I left some comments and old pieces (commented out) to explain to @Red5d what I did and why. Since I am new to this script and the docker-compose format i might have overlooked something. Please check.

Co-authored-by: d-EScape <8693608+d-EScape@users.noreply.github.com>
2022-08-20 14:36:47 -04:00
acdoussan
357fef9782 better handling for default networks (#42)
* better handling for default networks

* fix for issues/43

* check for none explictly rather than allowing truthy/falsy conversion

* update to read volume data from mounts, rather than host config binds

Co-authored-by: Adam Doussan <acdoussan@Adams-MacBook-Pro.local>
2022-08-14 17:54:43 -04:00
acdoussan
0c4ff4fb25 Fix volumes missing in generated compose file (#41)
* fix volume export based off of https://github.com/Red5d/docker-autocompose/issues/17#issuecomment-943041549

* remove unneeded space

* export volumes in addition to networks

* fix syntax error

* actuall fix syntax errors

Co-authored-by: Adam Doussan <acdoussan@Adams-MacBook-Pro.local>
2022-08-13 16:31:05 -04:00
Stefano
d6dddedb3d Add -a/--all flag to list all containers 2022-04-09 09:30:14 +02:00
Red5d
0dfdac353f Merge pull request #36 from ostafen/master
Format properly date/datetime labels
2022-03-16 09:24:12 -04:00
Alexander Petrenz
1af6b49233 added name attribute to every retrieved network 2022-03-11 08:59:55 +01:00
Alexander Petrenz
40aaf8e82c fixed network retrieval 2022-03-11 08:59:47 +01:00
Stefano
63810906f9 Format properly date/datetime labels 2022-03-10 20:45:35 +01:00
Stefano
caa747b605 Fix ERROR: network must be a mapping, not an array. 2022-03-10 15:32:50 +01:00
Alexander Petrenz
e6badd31c3 now collecting networks not present in every container 2022-03-08 15:49:49 +01:00
Alexander Petrenz
3f756235b2 command property: replace string concatenation by taking over given list 2022-03-08 14:33:33 +01:00
Moritz Schlarb
e7dbe41f23 Update autocompose.py
Print error message to stderr so that I will be seen when redirecting stdout to `docker-compose.yml`
2022-03-07 11:56:06 +01:00
Red5d
8ada367b9e Enable generating compose files for containers that aren't running. 2021-08-07 13:51:02 -04:00
Red5d
881b7979d5 Fix malformed 'devices' values 2021-07-28 23:43:07 -04:00
Red5d
a1f2aabdee Fix lines that depend on the 'networks' key being in values list 2021-07-28 23:19:19 -04:00
Red5d
d8e5aacf20 Exclude the 'networks' key if only the default bridge network is present 2021-07-28 23:13:17 -04:00
Red5d
0556a35376 Remove fields that are invalid in the compose v3 spec 2021-07-28 23:03:54 -04:00
Akshay
98704a81b6 Fix 'networks' in yaml
fix opts following official compose reference

[docker-compose reference](https://docs.docker.com/compose/compose-file/compose-file-v3/)
2021-03-14 21:05:41 +11:00
Red5d
b78da97768 Add additional networks stanza at the bottom of the output to support the networks attached to the container(s). 2018-08-24 19:44:24 -04:00
Red5d
e5ac520ff6 Support networks and network aliases. 2018-08-24 17:49:55 -04:00
Red5d
9e0fa327ee Update script to use new module version, output compose file version 3, and be able to generate a combined file for multiple containers. 2018-07-27 20:20:41 -04:00
Matt Davidson
bdb38eecac Update autocompose.py
Trying to iterate on cinspect['HostConfig']['PortBindings'] when it is equal to 'None' produces a TypeError
2018-07-15 11:13:38 -04:00
Red5d
0f1a9e9308 Fix setup file and reformat autocompose to fit setup requirements. 2016-01-02 23:11:51 -05:00
Red5d
9ea3380110 Added autocompose script. 2016-01-02 17:17:18 -05:00