9

I'm newbie to docker, I tried this command

docker run -it node:latest

then, I was in the node REPL,

Welcome to Node.js v16.3.0.
Type ".help" for more information.
>

I tried control+c ,but this quit the image,

Is there any way to go to the shell in this image?

user956609
  • 906
  • 7
  • 22
  • That container is just running a `node` processes; it doesn't have your application source code or anything else in it. You wouldn't typically "go to the shell" any more than if you were running a `node` REPL in a non-Docker development environment. You might look at Docker's [Sample application](https://docs.docker.com/get-started/02_our_app/) tutorial, which walks through a typical workflow of building and running a custom image, even based on Node. – David Maze Jun 10 '21 at 17:10

1 Answers1

13

In order to overwrite the entry point of the docker image you're using, you will need to use the --entrypoint flag in the run command.

docker run -it --entrypoint bash node:latest

For better understanding on how to work with already running docker container you can refer to the following question

Totem
  • 1,030
  • 7
  • 16