t.kanstantsin t.kanstantsin -3 years ago 103
Node.js Question

docker call program (nodejs) from another container (supervisor)

My docker-compose.yml is like:

nodejs:
build: .
dockerfile: Dockerfile-nodejs
tty: true
ports:
- "${SOCKET_PORT}:8081"
volumes:
- ../node:/var/www/html

supervisor:
build: .
dockerfile: Dockerfile-supervisor
tty: true
volumes:
- ..:/var/www/html
- ./config/supervisor/conf.d:/etc/supervisor/conf.d
links:
- nodejs:nodejs


And I've created supervisor program config file:

[program:nodejs.socket]
command=nodejs /var/www/html/node/server.js
autostart=true


But: I can't run this program, because supervisor's container


can't find command 'nodejs'





Question: Can I actually run nodejs from supervisor-container or I must install supervisor in nodejs-container?

Answer Source

Question: Can I actually run nodejs from supervisor-container or I must install supervisor in nodejs-container?

You must install supervisor in the image that holds nodejs, because supervisor needs to execute nodejs that means to have it as child process.

That is the common way. However, you can share the pid namespace between two containers, but you will need to have nodejs installed in the same image too. So at that point, that is becoming tricky.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download