this post was submitted on 17 Sep 2025
11 points (82.4% liked)

Ask Lemmy

34742 readers
1047 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either !asklemmyafterdark@lemmy.world or !asklemmynsfw@lemmynsfw.com. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email info@lemmy.world. For other questions check our partnered communities list, or use the search function.


6) No US Politics.
Please don't post about current US Politics. If you need to do this, try !politicaldiscussion@lemmy.world or !askusa@discuss.online


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 2 years ago
MODERATORS
 

Hi everybody!

I'm making a decentralised hosting software, and I often get the question "is there a docker?" from people wanting to try it out. There isn't so I have tried making one, but I don't really know how to set it all up...

The soft is split in two:

  • A server that is connected to the internet (both ways, so a port forward is needed)

  • A command line utility

There is also a storage space (in some /data/ folder) and a database (a SQLite one living in some /db/ folder).

Compiling a docker image for the server seems somewhat easy, the user have to provide the two folders and forward the port I guess.

But the command line tool is where I have no idea how to make it not a user experience nightmare in a docker image. Should I publish the soft as a cli or should I try to integrate it into the/a docker image anyways? Security is of importance, so maybe people don't want to run an "unknown" cli on their PC but would be okay if it's all docker used.

Thank you all!

top 12 comments
sorted by: hot top controversial new old
[–] CameronDev@programming.dev 4 points 6 days ago* (last edited 6 days ago) (1 children)

How much CLI is required? Easiest to put it in the container and give instructions to use it via docker exec -it server_container clitool [args] .

Instructions should include mount points for the DB, so it can be persisted. Providing a docker compose file is usually the best way to do that.

[–] Valmond@lemmy.world 3 points 6 days ago* (last edited 6 days ago) (2 children)

Thanks! Yup a docker compose is probably the way to go.

Can the cli load/save files from outside its environment? The cli "inserts" data (day an image), and also saves links locally (in user space). Can that be done? I feel the instructions via your "docker exec..." will be executed only in the docker environment, if that makes any sense?

Edit: I guess I can provide some sort of intermediate /work/ directory if nothing else.

[–] CameronDev@programming.dev 1 points 6 days ago* (last edited 6 days ago) (1 children)

Yeah, it runs inside the container, so that won't have access to the external filesystem's. And intermediate directory might work, but itll be a bit fiddly.

Maybe you could supply a script that does something like:

docker cp $FILE server_container:/tmp/workfile.jpg
docker exec -it cli_tool /tmp/workfile.jpg

Could do a reverse script as well for download?

Edit: you can also pipe the files to stdin of the command:

cat input.jpg | docker exec -it server_container cli_tool upload

docker exec - it server_container cli_tool download > output.jpg

[–] Valmond@lemmy.world 2 points 6 days ago

Yeah I probably have to build some sort of "pass through" script if I want the cli in a docker, which sort of defies the purpose of ease of use.

Maybe a simple script (just forwarding things and copying files) would be better "tolerated" as it can be checked more easily for bad code. Or I could just "make it work" so people can have a go at it at least I guess.

Thanks again!

[–] Gonzako@lemmy.world 1 points 6 days ago (1 children)

You can define where you want the volumes mounted so you can just have a folder where the cli utility will do it's work.

[–] Valmond@lemmy.world 1 points 6 days ago (1 children)

Yeah, lot's of copying and extra work for the user though.

[–] Gonzako@lemmy.world 1 points 5 days ago (1 children)
[–] Valmond@lemmy.world 1 points 5 days ago* (last edited 5 days ago) (1 children)

Can you link from inside a docker with that?? Or do you mean setting them up on the go in the working director?

[–] Gonzako@lemmy.world 2 points 5 days ago (1 children)

Not from inside but the volume can be placed anywhere on the filesystem. You'd define where they'd go on the docker compose. Look at a couple examples in https://www.linuxserver.io/ Great examples all around.

[–] Valmond@lemmy.world 1 points 5 days ago

Thank you. Yes I know about it, will check out the link, the more info the better!

[–] EnsignWashout@startrek.website 4 points 6 days ago (1 children)

What language is the CLI written in?

Yes, running a CLI from inside a container can be a pain, but it's not a big deal for the people asking.

I would just provide a trivial Dockerfile and see if anyone uses it.

[–] Valmond@lemmy.world 1 points 6 days ago

It's written in python.

Can it access files from outside its environment, are there any tricks for that?