Question: Best way to access docker container CLI?

Say I wanted to access the CLI of a running docker container (a Rockon in Rockstor), what’s the best way to achieve this?
I have seen references to ‘docker run’ and ‘docker exec’, but not completely 100% sure the best method.
My aim is to start an interactive CLI session inside a running Rockon.
Any advice gladly taken… :slight_smile:

Depending on the underlying container, and if it has the bash shell available, I usually use
docker exec -it containername bash. Some have only ash available (alpine linux based containers for example), so you would replace bash with sh
So e.g. for the Tautulli Rockon, the command line would be
docker exec -it tautulli bash
(you find the actually underlying container name using the docker ps command).
Once you’re done with what you were doing, just type exit and the session detaches, but the container continues to run.
Options used in the exec command: -i or --interactive (creating an interactive session) and option -t or --tty (allocate a pseudo-terminal).
Others might have different approaches, though.


Cheers @Hooverdan that is exactly what I’m looking for. I was able to get in to Rockon containers using this advice - many thanks indeed.

1 Like