简体   繁体   中英

Run docker image with external configuration file with fabric8 maven plugin

I am trying to run elasticmq over docker with maven. You can find my configuration for docker below. And also under the /src/main/resources/container/sqs/config folder I have custom queue configuration name as elasticmq.conf

<image>
    <alias>elastic-mq</alias>
    <name>s12v/elasticmq</name>
    <run>
        <ports>${elasticmq.port}:9324</ports>
        <volumes>
            <bind>
                <volume>${project.basedir}/src/main/resources/container/sqs/config/elasticmq.conf:/etc/elasticmq/elasticmq.conf</volume>
            </bind>
        </volumes>
    </run>
    <wait>
        <tcp>
            <host>127.0.0.1</host>
            <ports>
                <port>9324</port>
            </ports>
        </tcp>
    </wait>
</image>

When I run I am getting this error:

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.22.1:build (start) on project xxx-xxx-xxx: Unable to parse configuration of mojo io.fabric8:docker-maven-plugin:0.22.1:build for parameter wait: Cannot find 'wait' in class io.fabric8.maven.docker.config.ImageConfiguration -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :xxx-xxx-xxx

Is there anyone how can I fix this problem or how can I properly configure?

It is fixed like below, btw I decided to use another docker image regarding ElasticMQ.

<image>
    <alias>elastic-mq</alias>
    <name>softwaremill/elasticmq:0.14.6</name>
    <run>
        <ports>
            <port>9324:9324</port>
        </ports>
        <volumes>
            <bind>
                <volume>${project.basedir}/src/main/resources/container/sqs/config/elasticmq.conf:/opt/elasticmq.conf</volume>
            </bind>
        </volumes>
    </run>
</image>

According to the documentation your <wait> element should be inside the <run> element. Like this:

<image>
  <alias>elastic-mq</alias>
  <name>s12v/elasticmq</name>
  <run>
    <ports>${elasticmq.port}:9324</ports>
    <volumes>
      <bind>
        <volume>${project.basedir}/src/main/resources/container/sqs/config/elasticmq.conf:/etc/elasticmq/elasticmq.conf</volume>
      </bind>
    </volumes>
    <wait>
      <tcp>
        <host>127.0.0.1</host>
        <ports>
          <port>9324</port>
        </ports>
      </tcp>
    </wait>
  </run>
</image>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM