Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Ask Lemmy
  3. Docker of server with cli question

Docker of server with cli question

Scheduled Pinned Locked Moved Ask Lemmy
asklemmy
10 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V This user is from outside of this forum
    V This user is from outside of this forum
    [email protected]
    wrote last edited by
    #1

    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!

    C 1 Reply Last reply
    8
    • V [email protected]

      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!

      C This user is from outside of this forum
      C This user is from outside of this forum
      [email protected]
      wrote last edited by [email protected]
      #2

      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.

      V 1 Reply Last reply
      2
      • C [email protected]

        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.

        V This user is from outside of this forum
        V This user is from outside of this forum
        [email protected]
        wrote last edited by [email protected]
        #3

        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.

        G C 2 Replies Last reply
        1
        • V [email protected]

          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.

          G This user is from outside of this forum
          G This user is from outside of this forum
          [email protected]
          wrote last edited by
          #4

          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.

          V 1 Reply Last reply
          0
          • V [email protected]

            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.

            C This user is from outside of this forum
            C This user is from outside of this forum
            [email protected]
            wrote last edited by [email protected]
            #5

            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

            V 1 Reply Last reply
            0
            • G [email protected]

              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.

              V This user is from outside of this forum
              V This user is from outside of this forum
              [email protected]
              wrote last edited by
              #6

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

              G 1 Reply Last reply
              0
              • C [email protected]

                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

                V This user is from outside of this forum
                V This user is from outside of this forum
                [email protected]
                wrote last edited by
                #7

                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!

                1 Reply Last reply
                1
                • V [email protected]

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

                  G This user is from outside of this forum
                  G This user is from outside of this forum
                  [email protected]
                  wrote last edited by
                  #8

                  symlinks?

                  V 1 Reply Last reply
                  0
                  • G [email protected]

                    symlinks?

                    V This user is from outside of this forum
                    V This user is from outside of this forum
                    [email protected]
                    wrote last edited by [email protected]
                    #9

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

                    G 1 Reply Last reply
                    0
                    • V [email protected]

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

                      G This user is from outside of this forum
                      G This user is from outside of this forum
                      [email protected]
                      wrote last edited by
                      #10

                      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.

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups