Search code examples
dockerdocker-composedocker-swarmdocker-machine

Docker Loaded by run command but can't access console


I built a Dockerfile where build command was successful

sudo docker build --network=host -t nid-robotic-server .

But when I try to run the file with

docker run -it nid-robotic-server

It jut exits.

rafa@ace:/home/automation$ docker run -it robotic-server
8:C 02 Dec 2018 11:39:05.871 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8:C 02 Dec 2018 11:39:05.871 # Redis version=5.0.2, bits=64, commit=00000000, modified=0, pid=8, just started
8:C 02 Dec 2018 11:39:05.871 # Configuration loaded
rafa@ace:/home/automation$

Can anyone help me with this? It would be a great help.


Solution

  • docker run -it --entrypoint="/bin/sh" nid-robotic-server
    

    or

    docker run -it --entrypoint="/bin/bash" nid-robotic-server
    

    should work for you.

    It depends how you configure the ENTRYPOINT and CMD in you dockerfile. If you define something else than shell as entrypoint, you won't be able to "simply" run your container interactively, you need to override the entrypoint with --entrypoint first.

    If you are planing to run you images as dameon, setting something other than shell for entrypoint is completely fine and even good practice (which is the usual case with docker).

    See https://docs.docker.com/engine/reference/builder/#entrypoint for more info.