0

I'm using docker compose to create a docker network, where my Web App and ArangoDB containers are working together. My goal is to restore Arango's data with arangorestore cli-tool, but I need to invoke it from inside my Web App code (from a python code actually - I'm developing with Django framework) where I don't have ArangoDB installed (which means arangorestore command could not be found by bash). How can I make ArangoDB execute arangorestore from another container?

Obviously, I don't want to install arangodb inside my Web App container (that's why i've separated them in the first place, according to official docker's recomendation - 1 service per container). So, i need to somehow connect to ArangoDB container and invoke arangorestore from there. I can imagine doing that over ssh, but it means installing openssh and messing around with keys. May be there are other options for me?

Containers can communicate with each other via port-forwarding, so I thought I could use it, but I don't know how.

I would appreciate if someone could help me.

  • You need to install the ArangoDB client tools in your application container. You don't necessarily need a copy of the database running there, but you do need the `arangorestore` command available in the application image. There is no way for one container to run a command in another (without either the complexities of the ssh setup you describe or the gaping security issues of exposing the Docker socket to the container). – David Maze Jun 23 '23 at 15:18
  • Related: [Docker : Can a container A call an executable located on an other container B?](https://stackoverflow.com/questions/43442276/docker-can-a-container-a-call-an-executable-located-on-an-other-container-b); [How to execute command from one docker container to another](https://stackoverflow.com/questions/59035543/how-to-execute-command-from-one-docker-container-to-another). – David Maze Jun 23 '23 at 15:19
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 23 '23 at 15:26
  • @DavidMaze okay, I see. But wouldn't it be overloading the whole system having the same installed packages in 2 different containers? Bc that was the main reason why I decided to ask for a better solution in the first place. – Борис Буклов Jun 23 '23 at 15:26
  • Imagine installing the database on dedicated hardware (often a good idea in any case). How would you go about initiating your dump from the application, particularly if your system administrators won't give you login access to the server? You _must_ install the client tools alongside your application in this case. The same logic applies to running things in containers. – David Maze Jun 23 '23 at 20:46

0 Answers0