I developed a microservices application with spring boot and now I would like to deploy it and I have to make a choice between docker or osgi, but I don't know much about osgi so What are the advantages of using OSGi over Docker containers and vice versa ?.
There is no such thing like OSGi vs Docker container. They solve problems in their own domain. In fact, both can come in as a powerful way to develop Java systems.
OSGi helps you build a modular application. But it runs in a single JVM process. Docker comes into play when you have multiple java application with different runtime requirements. There docker can help you in managing the deployment process which turns pretty messy otherwise. Docker specially helps when your solution is architectured as a microservice.
In short, OSGi is no more than a Java container providing an alternative to running Java code on JVMs. In contrast, docker containers provide an entire runtime helping you in deployments.