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

Proposal: Build to Docker Daemon #223

Merged
merged 17 commits into from
May 1, 2018
Merged

Proposal: Build to Docker Daemon #223

merged 17 commits into from
May 1, 2018

Conversation

coollog
Copy link
Contributor

@coollog coollog commented Apr 20, 2018


## Intended Workflow

Building to a Docker daemon should be as simple as calling the build task/goal (`jib:build` for Maven and `jib` for Gradle) with an additional parameter called `buildToDockerDaemon` enabled.
Copy link
Member

@loosebazooka loosebazooka Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just add a new task? I'm definitely not suggesting we do this, just wondering if we should or should not.

jib:buildToDockerDaemon?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if we do this, perhaps we can match the bazel dockerless builds and also produce an intermediate tar, which may or may not help us with simple skaffold integration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a new task does sound good so that we wouldn't need any extra configuration to clutter the default build+push workflow. And yeah, exporting the intermediate tar sounds good. Maybe we can instead do:

jib:tar to build the tar
jib:load to load the tar into the Docker daemon

This way, we could implement jib:tar first to enable integration with Skaffold.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided on jib:buildDocker

@coollog
Copy link
Contributor Author

coollog commented Apr 30, 2018

After looking into both https://github.com/docker-java/docker-java and https://github.com/spotify/docker-client, it looks like https://github.com/docker-java/docker-java is what we want since it uses the same (AFAICT) default Docker daemon as the docker CLI with DockerClient dockerClient = DockerClientBuilder.getInstance().build();

@loosebazooka
Copy link
Member

The non-process option would be kind of nice, but it might be worth it to be careful pulling in a complex dependency like docker-java, it itself has a large number of dependencies and we might not want to complicate a user's build dependencies for a single docker operation.

@coollog
Copy link
Contributor Author

coollog commented Apr 30, 2018

Updated to use the docker CLI.

## Constraints

* Building to local Docker daemon should be an extra feature, not the default
* Should not depend on a Docker CLI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess were doing this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

1. Find the Docker daemon.
- This should use the same Docker daemon that the `docker` CLI would.
- The default host is `unix:///var/run/docker.sock` or `tcp://127.0.0.1:2375`.
- Remote Docker daemon can be configured with environment variables, such as those output by `minikube docker-env`. These include:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we have to allow the user to configure this on our process?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it would just use the environment variables Jib was run in?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I forgot about that.

@coollog coollog merged commit 9a92dfd into master May 1, 2018
@coollog coollog deleted the proposal-dockerbuild branch May 1, 2018 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal question User inquiries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants