extended usage<\/a> part of the jib documentation.<\/p>\nCredential management<\/h3>\n I composed this configuration rather quick and as I was already using the wincred credential helper on my Windows 10 laptop and was logged into my DockerHub account, I was certain that it was going to work out of the box. Sadly, it didn\u2019t ?. It didn’t work because I wasn\u2019t aware that my credential helper had stored my credentials for the official DockerHub API Url \u201chttps:\/\/index.docker.io\/v1\/\u201d. You have to store the credentials for the exact URL you specified in the xml<image><\/code> tag of your pom.xml, so in my case “registry.hub.docker.com”. Hence, it doesn\u2019t work when you specify a protocol either, as I tried out with the registry URL \u201chttps:\/\/registry.hub.docker.com\u201d.<\/p>\nThis confused me for longer than it should have, because at first I didn\u2019t even know how to store new credentials in the credential helper. Furthermore, there are no examples in the documentation of the plugin nor on the documentation of the credential-helper itself. Eventually, I was able to store the credentials for the example above in the docker-credentials-wincred using the Windows PowerShell with following command:<\/p>\n
type .\\credentials.txt | .\\docker-credential-wincred.exe store\r\n<\/code><\/pre>\nThe content of credentials.txt<\/em> is<\/p>\n{ \r\n \"ServerURL\": \"registry.hub.docker.com\",\r\n \"Username\": \"craftcodecrew\", \r\n \"Secret\": {my-super-secret-password} \r\n}\r\n<\/code><\/pre>\nThe type<\/em> command is similar to cat<\/em> on Linux systems, so the command pipes the contents of the credentials.txt<\/code> file into the standard input. The docker-credential-wincred<\/em> application reads from and stores a new credential into the application. \nI could have just put the credentials in the settings.xml<\/code> in my .m2<\/code> folder, but I just had to get it done with the credential helper. I realize that this is probably quite a rookie mistake, but Jib is supposed to be especially designed for Java Developers who are not very experienced with containerization. \nTherefore, I would have appreciated a little more documentation for the credential management either on the plugin or the credential management website. Hopefully my struggle with the credentials helps you getting your configuration done faster than me.<\/p>\nAfter I figured this out, the build process worked smoothly and I was able to push my containerized Hello World<\/em> application effortlessly to DockerHub with the following command<\/p>\nmvn compile jib:build\r\n<\/code><\/pre>\nIf this command is too long for you to type you can also bind the Jib containerization to a Maven lifecycle of your liking, for example package<\/code>. You just have to add a <execution><\/code> tag to the plugin definition of Jib<\/p>\n<plugin>\r\n <groupId>com.google.com.tools<\/groupId>\r\n <artifactId>jib-maven-plugin<\/artifactId>\r\n ...\r\n <executions>\r\n <execution>\r\n <phase>package<\/phase>\r\n <goals>\r\n <goal>build<\/goal>\r\n <\/goals>\r\n <\/execution>\r\n <\/executions>\r\n<\/plugin>\r\n<\/code><\/pre>\nNow you can build a jar, make a container image out of it and finally push it to a docker registry by simply typing mvn package<\/code>. If that isn’t convenient I don’t know what is. You can try out my awesome Hello world<\/em> container by typing the command<\/p>\ndocker pull craftcodecrew\/jibdemo\r\ndocker run craftcodecrew\/jibdemo\r\n<\/code><\/pre>\nThe example code is available in our GitHub organization<\/a>.<\/p>\nConclusion<\/h2>\n Coming back to the three promises Google made, I can confirm all three of them as confidently as someone who containerized a Hello World application with it. The only real struggle was the fumbling around with the credentials and the credential helper, but that was only partly the “fault” of the Jib plugin. I will try to set up Jib for more complex applications in the near future, propably on some Spring Boot applications, so stay tuned for an update on this post.<\/p>\n
Cheers, \nLeon<\/p>\n","protected":false},"excerpt":{"rendered":"
Hey guys, last week I stumbled upon an announcement on the Google Cloud Platform. They presented a new open-source tool which aims to ease the containerization of your Java project. Without even reading the whole announcement, I declared it the topic of my next blog post. Well, here it is \ud83d\ude42 What is Jib? Jib is a containerizer for Java … Read More<\/a><\/p>\n","protected":false},"author":7,"featured_media":2360,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[108,109],"tags":[],"acf":[],"yoast_head":"\nA quick Introduction to Jib from Leon Gottschick - CraftCoders.app<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n\t \n\t \n\t \n