Jump to content

Accessing a Docker Container Filesystem


danioj

Recommended Posts

Hello All,

 

I thought I would share with you something I learned today.

 

I had just installed Maraschino (which for those who don't know is a simple web interface to act as a nice overview/front page for a Kodi / Openelec powered HTPC) via smidgeon's template repository (https://lime-technology.com/forum/index.php?topic=34009.0) to replace the instance of it I had running on my HTPC living room. I wanted to migrate to my server because in my home Maraschino is used as the browser homepage on many devices BUT the living room HTPC is not always on.

 

Anyway - I absolutely HATE the default grass background (grass.jpg) which comes installed as default. I wanted a nice "simpler" background. Anyway - in the past all I have done is replaced the grass.jpg located in the relevant folder in the installation with my own background also named grass.jpg. Voila. I have my nice background and no more grass.

 

When I installed the docker however I realised that in the /config folder didn't contain the location of the .grass.jpg file. I realised what I would have to do is map a volume to that folder so I can change the files BUT then I realised I had NO idea where this folder was in the container file system.

 

Note: I could have "guessed": which I did really. I went to the git homepage for the project, looked at the folder structure and figured if the thing was installed in /opt then I could work it out and map the volume accordingly.

 

BUT I wanted to be sure. So I did the following to check:

 

Telnet into unraid

 

Get the docker id:

 

docker ps

 

Which gives something like this as its output:

 

CONTAINER ID        IMAGE                                     COMMAND             CREATED             STATUS              PORTS                              NAMES
fbfe739c2dbd        smdion/docker-maraschino:latest           "/sbin/my_init"     32 seconds ago      Up 32 seconds                                          Maraschino          
003aca2445fd        needo/sickrage:latest                     "/sbin/my_init"     40 minutes ago      Up 40 minutes                                          SickRage            
4e7bfeccee8a        needo/sabnzbd:latest                      "/sbin/my_init"     45 minutes ago      Up 45 minutes                                          SABnzbd             
97abad94019e        sparklyballs/headless-kodi-helix:latest   "/sbin/my_init"     2 hours ago         Up 2 hours          9777/udp, 0.0.0.0:8090->8080/tcp   KODI-Headless       
5c64f3d65868        smdion/docker-htpcmanager:latest          "/sbin/my_init"     39 hours ago        Up 39 hours                                            HTPC-Manager        
6074398c0a6b        needo/mariadb:latest                      "/sbin/my_init"     40 hours ago        Up 40 hours                                            MariaDB             
87ca4f105585        needo/couchpotato:latest                  "/sbin/my_init"     42 hours ago        Up 42 hours                                            CouchPotato         

 

So as I can clearly see the Maraschino id is: fbfe739c2dbd

 

Access the container filesystem using  syntax "docker exec -t -i <container id> /bin/bash":

 

docker exec -t -i fbfe739c2dbd /bin/bash

 

This then took me to a command prompt:

 

root@main:/#

 

So with a quick:

 

ls /opt/maraschino/static/images/backgrounds/

 

I could see that the grass.jpg was indeed there.

 

Exit the container prompt and return to Unraid prompt

 

exit

 

Now I was out of the container file system.

 

I then went on and mapped a volume in the docker to that location and boom - after copying the files from the git source into that folder - I was able to change grass.jpg to my own custom background.

 

Anyway - just thought I would share.

 

Daniel

Link to comment

use the container name instead of the ID

 

ie

 

docker exec -it Maraschino bash

 

helluva lot easier to remember Maraschino than a seemingly random string of characters.

 

 

and any changes you make to the image file system that aren't saved locally to an unraid folder will be lost if you ever have to update or edit the container

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...