Filled out README more and opted for getting FS user from environment rather than hardcoding

This commit is contained in:
2024-11-13 20:35:58 -05:00
parent 4e9f1c081c
commit d5fee4c30a
2 changed files with 72 additions and 2 deletions

View File

@@ -1,7 +1,75 @@
This is a research project on the viability of a filesystem API for controlling Docker containers. Before being public on git many hours were put into designing a simple base to further work on.
The fileserver relies on a tree system for dynamically generating information about containers. Upon reading the contents of the root directory the file server will dynamically generate a filesystem based on a list of currently running docker containers.
Make sure you have atleast go 1.23.2 installed for the docker sdk deps
Make sure you have docker installed
Make sure you have 9mount installed for the test script
Make sure you mkdir $HOME/n for the test script
To build the server:
```
go mod tidy
go build
```
To run the server:
```
./dockerfs_research
```
To mount the server manually:
```
mkdir -pv $HOME/n/dockerfs
9mount 'tcp!localhost!9999' $HOME/n/dockerfs
```
To unmount the server manually:
```
9umount $HOME/n/dockerfs
```
While running the server I recommend creating a few docker containers then running find on $HOME/n/dockerfs.
Run 3 or 4 times. Alternatively use any container image desired.
```
docker run -d -t ubuntu:latest /bin/bash
```
Using find will show the mapped information.
```
$ find $HOME/n/dockerfs
/home/maxine/n/dockerfs
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/Names
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/Names/0
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/Image
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/ImageID
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/Command
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/Created
/home/maxine/n/dockerfs/9666de49a66046f3625923cb289e7bb09d9d85aa42130449ef3bf7a2014af657/ID
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/ID
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/Names
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/Names/0
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/Image
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/ImageID
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/Command
/home/maxine/n/dockerfs/06156b840698661494c45c50d695b696ebcc9aae3059d7a2fc4e69feb128ed67/Created
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/ID
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/Names
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/Names/0
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/Image
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/ImageID
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/Command
/home/maxine/n/dockerfs/333cb4d6269b74c4c371f7352638aa0f6ed15a2f7ee61dc8890fd40390092072/Created
...
```
Try killing some containers using `docker kill` then checking the filesystem again.
```
docker kill ContainerID
```

View File

@@ -1,4 +1,6 @@
9mount 'tcp!localhost!9999' $HOME/n/reqfs
[ ! -d "$HOME/n/dockerfs" ] && mkdir -pv "$HOME/n/dockerfs"
9mount 'tcp!localhost!9999' $HOME/n/dockerfs || { echo "Please make sure the file server is running"; exit 1; }
find $HOME/n/reqfs