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

158
Vistas
Docker container exits right away, but not when using the Docker desktop application to run the command

I am creating a console-based app in Node JS. No ports are being used... It's just a basic app. The problem I am having is using Docker to run my app.

Here's my docker file:

FROM node:16

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

CMD [ "node", "index.js" ]

After building the image, I try to run 'docker run ' and the container just exits right away. However, when i use the Docker desktop app, after building the image, if I click 'run' it builds the container and does not exit, but actually runs. When I log into that container, I am able to run 'node index.js' and my node app runs fine.

My question is, why does it work when using the GUI docker run and not my command? Also, why do I have to run 'node index.js' manually when the docker file should take care of that?

Commands to build image and run the container:

Image build:

docker build -t 'appname' .

Create container:

docker run 'appname'
about 4 years ago · Juan Pablo Isaza
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