Issue
I use jib plugin to create image, while docker-compose needs Dockerfile. How can i Link already made image by jib to my docker-compose so it can build my backend in process?
Solution
gradle jibDockerBuild && docker-compose up
is a reasonable workaround. You just need to set a correct image name in the image:
property (instead of build:
) in docker-compose.yml
. The jibDockerBuild
command will be almost no-op (barring the time needed to push an image to your Docker daemon) when there is no change to your app. When you make a change, Jib will build a new image and docker-compose
will use it. Of course, if you don't have to rebuild the image by Jib, docker-compose up
alone will suffice, which will just use the current image in your Docker daemon cache.
Another option: pushing to and pulling from a registry (whether local or remote) with gradle jib && docker pull <your image> && docker-compose up
may be faster if your image is large and you have decent network bandwidth. (This is because Docker Engine API has limited capability compared to Docker Registry API; Jib has to stream an entire image to a Docker daemon with jibDockerBuild
.
Answered By - Chanseok Oh