How to access root folder inside a Docker container?

How do I access the main directory of a Docker container? I can’t find the answer anywhere, everyone shares the document link of any page but no action.

Or isn’t that possible?

The simplest way to do this is for you to create a remote bash session to the container. From your Docker host execute the command docker exec -it <containerName> bash. Once that executes it will bring up the bash for the container you specified. Then you can use regular bash commands like ls and cd to access the filesystem.

1 Like

Great! I made access, Is it possible to access via (S)FTP?

I found this [link]:

docker run --name containername -p 3000:80 -p 3001:21 -d dockerimagename

Console:

[root@localhost ~]# docker run --name 2839b9d63a06 -p 3000:80 -p 3001:21 -d jitsi/web
2e8dc609233f8b9e3ac48a5a1e9e07fd27960a35dae11f191f27dc43b1f4df41

But I still can’t access FTP.

Filezilla Console:

|Status:|Connecting to 192.168.1.250:3001...|
|Status:|Connection attempt failed with "ECONNREFUSED - Connection refused by server".|

Do I need to make any changes to these files? => docker-compose.yml or .env

Thank you in advance for your help.

Your container is not running an FTP service. It’s a feature of Docker containers that they contain only the services needed to work, and nothing more. You’d need to add an ftpd package to the Dockerfile using its package manager (which depends on the distribution it’s running) and rebuild the container image.

To further clarify what is happening here. When you pass the -p switch in the command line it maps port 21 (FTP) to port 3001 in this instance. Like @chuckadams mentioned, you will still need an FTP or SFTP service running on the container image to receive the connection from that port.

Thank you for your help. I got it.