user11492299
user11492299

Reputation:

How to call from ContainerA call / run Shell Script that's in ContainerB?

I have two linux docker containers: * ContainerA - tomcat image - running a java app * ContainerB - ubuntu image - execution of shell script runs a CLI linux application

ContainerA doesn't have busybox hence can't run the shell script, and needs to be seperated from the linux app due to large filesize - hence two docker containers.

I'm trying to call from ContainerA the shell script which in ContainerB, but can't access it.

  1. Was looking into --links but it's not networking. I'm confused how to proceed or in making it work.

Upvotes: 0

Views: 48

Answers (1)

bellackn
bellackn

Reputation: 2174

As I've already pointed out in the comments, this is something you won't find a simple OOTB Docker solution for. Containers usually talk to each other via networking protocols (HTTP) and are therefore not so different from actual, spatially divided machines. So, you would need an API on your container B that returns the resource that you want to the requesting end (container A in your case). APIs can be built in numerous ways; I've already mentioned Flask for Python. Jersey seems to be a similar framework for Java.

Implementing this is not done in a breeze, but I don't see how to approach this in another way, besides rethinking your setup as a whole.

Upvotes: 1

Related Questions