Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow 'extraHosts' to accept hostname as destination ip #196

Closed
jgangemi opened this issue Jun 15, 2015 · 4 comments
Closed

allow 'extraHosts' to accept hostname as destination ip #196

jgangemi opened this issue Jun 15, 2015 · 4 comments
Assignees

Comments

@jgangemi
Copy link
Collaborator

this is similar to #101.

i want to specify a hostname as the destination address in the maven configuration that will be resolved to an ip address at runtime, eg:

<run>
  <extraHosts>
    <host>dev-db.hostname.pvt:docker-dev.hostname.pvt</host>
  </extraHosts>
</run>

this lets me inject the correct ip address by way of /etc/hosts instead of using maven properties.

if the specified host cannot be resolved at start time, the plugin will throw an error.

@jgangemi jgangemi self-assigned this Jun 15, 2015
@rhuss
Copy link
Collaborator

rhuss commented Jun 15, 2015

If I understand right, you want in you example docker-dev.hostname.url to be looked up by the plugin before handing it over to Docker as extraHosts.

Looks good to me.

@rakeshbalan
Copy link

rakeshbalan commented Aug 8, 2017

@rhuss I am using the hostname of a running container instead of its IP. But I am getting the following error
unable to resolve ip address for <container-hostname>: Unknown host <container-hostname>: Name or service not known

Am I missing anything!!!

                             <image>
                                <name>docker.io/rabbitmq:${docker.rabbitmq.version}</name>
                                <alias>rabbitmq-az1</alias>
                                <run>
                                    <namingStrategy>alias</namingStrategy>
                                    <hostname>rabbitmq-az1</hostname>
                                    <ports>
                                        <port>15673:15672</port>
                                    </ports>
                                    <wait>
                                        <time>30000</time>
                                        <log>Server startup complete*</log>
                                        <exec>
                                            <postStart>rabbitmq-plugins enable rabbitmq_management</postStart>
                                        </exec>
                                    </wait>
                                </run>
                            </image>
                         <image>
                                <name>${docker-organization-name}/pulse-az1:${project.version}</name>
                                <alias>pulse-az1</alias>
                                <run>
                                    <namingStrategy>alias</namingStrategy>
                                    <hostname>pulse-az1</hostname>
                                    <extraHosts>
                                        <extraHost>rabbitmq:rabbitmq-az1</extraHost>
                                    </extraHosts>
                                    <ports>
                                        <port>8081:8080</port>
                                    </ports>
                                    <env>
                                        <SOH_LOGLEVEL>ALL</SOH_LOGLEVEL>
                                    </env>
                                    <links>
                                        <link>rabbitmq-az1</link>
                                    </links>
                                    <wait>
                                        <time>600000</time>
                                        <log>transitioning from STARTING to STARTED</log>
                                    </wait>
                                    <log>
                                        <prefix>PULSE-AZ1</prefix>
                                        <date>default</date>
                                        <color>blue</color>
                                    </log>
                                </run>
                            </image>

EXACT ERROR:
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.16.9:start (default-cli) on project docker-assemble: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.16.9:start failed: Failed to create contained configuration for [feedzai/stateofohio/pulse-az1:3.1-SNAPSHOT]: unable to resolve ip address for rabbitmq-az1: Unknown host rabbitmq-az1: Name or service not known

@rhuss
Copy link
Collaborator

rhuss commented Aug 8, 2017

@rlingaku Could you add a <dependsOn> as described here --> https://dmp.fabric8.io/#start-depends-on ?

Does this help ?

@rakeshbalan
Copy link

@rhuss I tried with <dependsOn>, but I still get the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants