Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
How to send STDIN to docker process

I have a nodemon running in a docker container in development. I have successfully setup live reloading when code changes.

However sometimes I write some code where nodemon crashes. Nodemon can be manually restarted when you type 'rs' (when running locally).

The problem is that within a docker container I can't get it to restart.

I've tried the following with no luck:

docker exec -it add92j rs ====> rs not found

docker exec -it add92j sh -c echo rs ====> just echos rs

I've also tried docker attach and then typing rs but it doesn't work.

I've also tried using the shell with docker exec -it sh, getting the process with ps aux and then:

echo rs > /proc/PID/fd/0

But that also doesn't work. (Note I've tried all the above variants with rs and rs\n and using printf and echo).

In the nodemon github I see that it looks for 'rs\n' to trigger a restart and there is a reference to SIGUSR2. Hence I've tried also kill -12 PID but that just kills my process. Note that I checked to see that 12 is indeed SIGUSR2 in my container.

The processes actually running in my container with ps aux are:

 1 root       0:00 npm
14 root       0:00 sh -c DEBUG=app:* nodemon
15 root       0:00 node /workspace/node_modules/.bin/nodemon
29 root       0:00 sh -c node server/register.js
30 root       0:01 node server/register.js

So my question is, how do I send text to stdin for a process in docker?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Running the nodemon container with a -t tty and -i for stdin allows you to control nodemon after a docker attach

→ CID=$(docker run -dti dply/node-docker-demo-app:nodemon)
→ docker attach $CID
rs
[nodemon] starting `node /app/index.js`
Listening on 8080
^Csigint
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda