How to access docker container filesystem and terminal?

Total
0
Shares
access docker container filesystem and terminal

To access docker container filesystem and terminal, use this command –

docker exec -it {container_id} /bin/bash

Here the choice of terminal depends on the flavor of operating system used by container image. Some of them uses /bin/bash while some uses /bin/sh.

For mongodb container, my-mongo-container, which we created in our last article, the command works like this –

docker exec -it my-mongo-container /bin/bash

It will attach the bash terminal of the container to the host command line.

open bash terminal of the container

From the image you can see that we have successfully attached the bash terminal of our mongo container. Now we can run any terminal command like ls, pwd, cd etc. This way you can access the whole filesystem of this container.

running terminal commands in container

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like
plex sonarr radarr jackett transmission docker

sonarr radarr jackett transmission docker

Table of Contents Hide PlexSonarrRadarrJackettTransmissionDocker-compose for Plex, Sonarr, Radarr, Jackett and TransmissionConclusion In this article we will see how to run docker containers for Plex, Sonarr, Radarr, Jackett and Transmission.…
View Post