Home > Blockchain >  Have command line available upon running Dockerfile
Have command line available upon running Dockerfile

Time:09-23

I just can't seem to find exactly how to have a command line available when starting a Dockerfile. Is there a certain parameter I can set inside the Dockerfile which will give a command line upon starting the image within a Docker container?

CodePudding user response:

Ah it is a very simple solution

CMD ["/bin/bash"]

CodePudding user response:

When you run a container you can add option -it

docker run -it some/image:tag

From docs:

For interactive processes (like a shell), you must use -i -t together in order to allocate a tty for the container process. -i -t is often written -it as you’ll see in later examples. Specifying -t is forbidden when the client is receiving its standard input from a pipe, as in

  • Related