fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.87k stars 640 forks source link

Log file not working with compose #1141

Open ben-gineer opened 5 years ago

ben-gineer commented 5 years ago

Description

I'm unable to persist any logs when using the compose form of configuration.

Here's my compose:

version: "2"
services:
  mysql:
    image: myproduct.com/mysql:${datalayerversion}
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=1234
xo-management-service:
    image: myproduct.com/xo-management-service:${projectversion}
    ports:
      - "8093:8093"
    links:
      - mysql
    environment:
      - loglevel=debug
      - dbtype=MYSQL
      - dbclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
      - dbhost=mysql
      - dbname=cd_broker_discovery_db
      - dbuser=root
      - dbpassword=1234
      - dbport=3306
      - service=xo-management-service
    container_name: "xo-management-service"

Here's my pom:

<plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>start-test-containers</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-test-containers</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <logStdout>true</logStdout>
                            <logDate>default</logDate>
                            <verbose>true</verbose>
                            <images>
                                <image>
                                    <alias>xo-management-service</alias>
                                    <external>
                                        <ignoreBuild>true</ignoreBuild>
                                        <type>compose</type>
                                    </external>
                                    <run>
                                        <wait>
                                            <http>
                                                <url>http://${docker.host.address}:8093/health</url>
                                                <method>GET</method>
                                                <status>200</status>
                                            </http>
                                            <time>180000</time>
                                        </wait>
                                        <log>
                                            <enabled>true</enabled>
                                            <color>yellow</color>
                                            <file>${project.build.directory}/container.log</file>
                                            <driver>
                                                <name>json-file</name>
                                            </driver>
                                        </log>
                                    </run>
                                </image>
                            </images>
                            <imagePullPolicy>IfNotPresent</imagePullPolicy>
                        </configuration>
                    </plugin>

I've tried various combinations of the log file and driver options, but I'm not able to see any generated log files. The console output gets generated correctly.

Should the log setting work with compose files?

Info

dordnung commented 4 years ago

I can confirm this.

Without <external> logging to a file works fine, but when adding <external> for compose it stops working. Also <color> doesn't seem to work with compose