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

Setting up projects to build from both linux and boot2docker #68

Closed
filipncs opened this issue Jun 9, 2015 · 2 comments
Closed

Setting up projects to build from both linux and boot2docker #68

filipncs opened this issue Jun 9, 2015 · 2 comments

Comments

@filipncs
Copy link

filipncs commented Jun 9, 2015

It seems unnecessarily cumbersome to set up a project to be build both from linux hosts (with local docker running unsecured) and boot2docker.

The workaround for unsecured docker in the readme (an explicit http://localhost:2375 host entry in the configuration) overrides how boot2dockers docker host is discovered by environment variables. The best solution I've found is to put the http://localhost:2375 host value in a maven property, in a profile that's only activated when the DOCKER_HOST environment variable isn't set. E.g.:

<plugin>
    <groupId>com.alexecollins.docker</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    ...
    <configuration>
        <host>${docker.host}</host>
    </configuration>
</plugin>

...

<profile>
    <id>local-docker</id>
    <properties>
        <docker.host>http://localhost:2375</docker.host>
    </properties>
    <activation>
        <property>
            <name>!env.DOCKER_HOST</name>
        </property>
    </activation>
</profile>

Is there something I'm missing?

If the plugin defaulted to http when the host isn't actively set anywhere and the DOCKER_TLS_VERIFY environment variable isn't set to "1", I think this would cover most use cases, but I'm not sure I have the big picture.

@alexec
Copy link
Owner

alexec commented Jun 9, 2015

Hi, I use the docker-java library, so this change would need to be made there. Fancy giving it a go? Instructions here:

https://github.com/alexec/docker-maven-plugin/blob/master/CONTRIB.md

@filipncs
Copy link
Author

That could be a solution, if no other users of docker-java depend on the current functionality. In any event, the team I'm on decided to make everybody set the environment variable, even on linux, which solves the problem, without the maven profile trick.

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

No branches or pull requests

2 participants