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

Dynamic host property in port mapping is not filled in if port is specified #323

Closed
caspark opened this issue Nov 13, 2015 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@caspark
Copy link
Contributor

caspark commented Nov 13, 2015

I have a port mapping config like the following:

<run>
    <ports>
        <port>+docker.ondemand.postgres.host:docker.ondemand.postgres.port:5432</port>
    </ports>
</run>

Ordinarily, I can access ${docker.ondemand.postgres.host} & ${docker.ondemand.postgres.port} after the docker container has started.

But if I specify -Ddocker.ondemand.postgres.port=5432 then docker.ondemand.postgres.host is not dynamically set.

This appears to be because of the following snippet in org.jolokia.docker.maven.service.RunService#createAndStartContainer

    if (mappedPorts.containsDynamicPorts()) {
        updateMappedPorts(id, mappedPorts);
    }

Changing it to

    if (mappedPorts.containsDynamicPorts() || mappedPorts.containsDynamicHostIps()) {
        updateMappedPorts(id, mappedPorts);
    }

seems to fix this bug, so I'll raise a PR for this.

@joschi
Copy link

joschi commented Nov 26, 2015

+1, I also ran into this issue lately.

@rhuss
Copy link
Collaborator

rhuss commented Nov 26, 2015

Thanks, PR applied for 0.13.7

@rhuss rhuss added the fixed label Nov 26, 2015
@rhuss rhuss added this to the 0.13.7 milestone Nov 26, 2015
@rhuss rhuss self-assigned this Dec 2, 2015
@rhuss rhuss closed this as completed in a1c4a6c Dec 7, 2015
leusonmario pushed a commit to leusonmario/docker-maven-plugin that referenced this issue Aug 18, 2018
Add option to the build mojo which allows 'docker save' on image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants