LorenzoBerti
LorenzoBerti

Reputation: 6974

Call nmap from one container NodeJs

compose file:

version: '3'
networks:
  frontend:
    driver: bridge

services:

### Workspace Utilities ##################################
    workspace:
      build:
        context: ./workspace
      volumes:
        - './app/:/home/app'
      networks:
        - frontend  

### NMAP ###############################################

    nmap:
      build:
        context: ./nmap
      networks:
        - frontend     
      links:
        - workspace  

In my first container I have an App in Nodejs and PM2, in the second container Nmap. In my app, for now I call simply:

exec('nmap -A 192.168.1.1/24 oX test.xml', (error, stdout, stderr) => {
   .....
 });

How can I use nmap that is in second container from my first container?

Upvotes: 0

Views: 354

Answers (1)

David Maze
David Maze

Reputation: 159171

You can't. The two containers are isolated from each other. (Imagine they were two physically separate systems; how would you cause one to run a command on the other?)

If the second program is integral to the operation of the first, you'd need to build a single image and install that tool into the image.

Upvotes: 1

Related Questions