UPDATE 07/05/2021: added my own Docker image link considering the initial one was deprecated.
This article will be all about running a great file manager tool on your NAS using Docker, Midnight Commander.
MC is probably the most used tool that I have up and running all the time. I use it to manage my file/folder tasks on all of my NAS devices. Why not use File Station instead? Well, I am a bit old school and dual pane is my thing, let's leave it at that.
While back I have writen about a top file manager for macOS, Forklift and I do use it also all the time, but when it comes to NAS operation, especially for the root files/folders outside the usual /volume# path, MC is the right tool.
In the light of recent events, launching the preview version of DSM7 and its current termination of 3rd party tools, I have decided to try and run MC inside Docker in case I will not be able to install it on the NAS running the preview version of DSM, so here it is.
STEP01 - download and configure the Docker repo
For this case, I will use an up to date MC repo (and MC version) using this repo: https://hub.docker.com/r/blackvoidclub/midnight-commander
Log into you NAS via SSH and elevate to root with this command:
hit return and enter your current user password to get to root privileges.
After that run the following command to pull the image:
docker pull blackvoidclub/midnight-commander
and finally, run this command to start MC and mount it to your NAS file system
docker run -it --name=mc -v /:/mnt/host blackvoidclub/midnight-commander
You will notice that the -v parameter is mounted to the root (/) and mapped to a folder destination /mnt/host (this can be any destination inside you want, it doesn't have to be this one).
What this means is that the whole NAS file system will be mounted to that location that you can then use.
STEP 02 - logging on and off the MC container without destroying it
Now that you have logged in and can use MC lets see how to jump out of it and get back in without destroying/stopping the container.
The whole idea is that MC is there running all the time and you access it when you need to. So if you press F10 now and exit MC it will also stop the container session altogether.
To avoid that you will need to do this. To detach from MC and leave it running in the background using this keyboard combination:
CRTL + p CRTL + Q
So press CTRL +p and then after that CTRL + q. This will boot you back into your SSH session but will also leave MC running as a background.
To connect back to your MC instance use the docker attach command like so:
docker attach mc
So docker attach your_MC_container_name, and you are back in. Great right?
I have stopped the container, now what?
In case you have stopped the container by using the exit command in MC there is no need to start the whole process again and recreate it. You simply start your existing container and attach to it, that's it.
If you want to do it via a command line, use the following command:
docker start mc
Once you started it again, use the attach command and boom, you are good to go.
Hope this will be beneficial for someone as running MC on a NAS might not be always an option considering that the package has to be compatible with your CPU architecture, but if you have Docker support you can then use this method to get it up and running in no time.
Feel free to comment or ask any questions.