I jumped into Docker feet first a few months ago and have not had a real good time with it. Networking doesn’t make sense, I can’t ever seem to access config files without dropping to su -, all the tutorials and videos I find are pretty top level and assume the user already has a firm grasp on it. It’s great for drop in stuff like open speed test and Vaultwarden but I recently tried setting up dashy and I can’t even find the config files to edit. The Dashy documentation says the easiest way to edit the configs is to use code-server, so I spun up a code-server VM and can’t even get it to open the files because the web based VSC doesn’t allow for SSH editing. There’s nothing explained in the documentation beyond that.

Yes I’m frustrated but I’m not bitching as if these solutions are trash, I’m simply asking where can I go to learn this shit from the ground up? It doesn’t make any sense to me from the perspective that I’ve approached it. Networking seems to be silly and weird, entering an interactive TTY to the container seems to be useless as there’s no package manager and doesn’t seem to have vim, nano, or any native way to edit configs. It’s been extremely frustrating so I ask you, where can I learn what I’m doing wrong and how to properly work with Docker?

  • ryapric@lemmy.world
    link
    fedilink
    English
    arrow-up
    36
    ·
    1 year ago

    Echoing the sentiment that you should adjust your perspective in approaching containerization, otherwise you’re in for a tough time.

    Jerome Petazzoni, one of the more recognizable names in the container community, has a site where he puts all of his workshops, slides, etc. This is his one for getting started with Docker.

  • flubba86@lemmy.world
    link
    fedilink
    English
    arrow-up
    28
    ·
    1 year ago

    Sounds like you, like a lot of others, have come to docker from the perspective of “it’s like a mini virtual machine”. Maybe you’ve used VMs before, like virtualbox or VMware or EC2. Maybe you have experience with setting up a cluster of VMs, each with their own OS, own SSH client, own suite of applications, and an overlay network between them all. Maybe someone told you “you should use docker instead, it’s like mini lightweight VMs”. And you’d be right to assume this is the wrong perspective to approach docker, because it leads to the problems you have faced.

    Instead, try to think of docker containers as standalone applications. They don’t contain a kernel, they don’t have SSH, no Nano or VIM, just simply the Application, in a container, with enough supporting filesystem and OS libraries to make the application work.

    That perspective is what helped me to get better at docker, I know it’s not exactly answering your question, but it might help.

    • dartanjinn@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      1
      ·
      1 year ago

      “like mini lightweight VMs”

      That’s exactly how I’ve approached it cause that’s exactly how it was explained. But it’s not at all like that. Thanks for your explanation.

      • flubba86@lemmy.world
        link
        fedilink
        English
        arrow-up
        9
        ·
        1 year ago

        Same, that’s how it was explained to me too. It spent over a year learning docker the wrong way, and trying to use it as a replacement for VMs, after a coworker told me that.

  • PriorProject@lemmy.world
    link
    fedilink
    English
    arrow-up
    14
    ·
    edit-2
    1 year ago

    Others have pointed out that docker containers aren’t idiomatically like VMs and you interact with them differently. Some workflow tips:

    • Don’t edit configs in containers. Mount your config files as a volume. Edit them from your host using your normal editor and restart your container when they change.
    • Don’t exec into your running container and then try to install debugging tools as you need them. Use a Dockerfile to build an image that has the debugging tools you need and launch your container using that.
    • In general, mess with your container less while its running. Use dockerfiles, compose, and entry point scripts to set things up in your container so it’s the way you want it on startup. While its running, just use docker logs to see what it’s doing or run the occasional debugging command via exec if you must… but do more during container-build and startup and less after it’s running. Rebuild and restart the container a lot during debugging to make your changes take effect.

    The other issue in play here is that the fundamentals necessary to understand how docker containers run aren’t actually docker fundamentals. They’re:

    • Networking fundamentals. The container networking stack is really configurable and really complicated.
    • Volumes and config mounts are based on overlay filesystems.
    • Lots of docker issues are related to complex security systems like Linux capabilities.
    • All of these systems are configurable, and different docker setups use them different ways.

    These things aren’t trivial to learn, a thorough understanding of these things is the difference between a junior sysadmin and a senior one, and you WILL get exposed to them when things break. But step one in learning more is definitely to recognize that the hards parts of docker are rarely docker itself. Rather, the hard parts are their own thing. Figure out what Linux system you’re struggling with and start learning about that and how docker uses it rather than narrowly focusing your research on docker itself. Anything focusing on the docker piece must necessarily gloss over the real foundations which are often very complex… so this will start you expose you to deeper material that you can assemble in your own mind into an understanding of your own specific docker setup.

    • Voroxpete@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      I was in the process of writing basically this same post, but you’ve already said it very well.

      Docker isn’t really a technology in and of itself; its an applicable of many of the fundamental components of Linux to create a specific result. To really understand it you have to understand the technologies it’s built from.

      A recommendation I’ll throw in here for OP is How Linux Works by Brian Ward. This book is an excellent first step in really understanding those Linux fundamentals.

  • ColdCreasent@lemmy.ca
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    Lots of great information and suggestions in this discussion. Thank you everyone who are offering your input. I’d like to ask as well, how easy is it to setup docker for use in windows? I ask this because almost every guide I’ve found has docker running in Linux. I realize you are able to setup a docker in windows, but I was struggling to get basic instructions for windows, and even the tutorial in docker required me to switch back to docker types that don’t work in windows.

  • DontAskAboutUpdog@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Start by making a simple image and make a container of it (I started with a simple python webserver)

    Once you grasp basic cli commands and the docker lingo, try pulling portainer and use its web ui.

    Next step would be to customize an image.

    There is a lot of information on SO, and you can ask specific questions on sites like this one. YT videos are 99% shit. Avoid.

    I think docker is so stupidly awesome I nowdays dont want to do anything without it.

    • Falmarri@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      This is almost worse than using sudo. Because now you essentially have full sudo access without having the protections of sudo, like asking for your password

    • subtext@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Podman is supposed to be a sudo-less container manager. Though fair warning I hear it is also quite frustrating to start.

      • PriorProject@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        1 year ago

        Rootless podman (or docker) is a very different thing that adding yourself to the docker group. Rootless is an advanced topic that makes networking and other fundamental aspects of the container runtime work differently so it’s harder to exploit the runtime itself. Adding yourself to the docker group just gives your account permission access the docker daemon running as root… which is a much less fundamental change.

        I don’t recommend beginners to mess with rootless docker or rootless podman. Rootful podman is much more straightforward (though less well documented than docker).

      • dartanjinn@lemm.eeOP
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        1 year ago

        Yeah I spent a few hours with Podman before I went straight back to Docker.

  • unscholarly_source@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I took a look at Dashy, I think I see the confusion. If you are looking at this article, then yes they mention Code Server, but that’s purely in the context of using Dashy in a non-docker context. But to be honest, any text editor works.

    But I think that’s a red herring. That in itself has nothing to do with docker.

    What you’ll need to do, once you understand the fundamentals of running docker, pull images, start a container based on an imagine, is to expose a docker volume that points to /public/conf.yaml. A docker volume ensures that the file or directory it’s mapped to in the container is available and persists outside of the container. This allows you to persist files and directories without losing them once the container stops or restarts.

    Once the volume is exposed, then you can use your favorite text editor to update the dashy config file. Code Server is fine, powerful, but overkill.

    But first, try getting familiar with pulling, starting stopping docker images using the cli. Gotta start there first before tinkering with docker parameters like volumes.

    • dartanjinn@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      1 year ago

      Yeah Dashy isn’t really important to me, it’s just another fun project to learn more about Docker. However, what I learned is that I don’t know shit about what I’m doing lol. It proved to be a great tool at exposing my absolute ignorance of something I thought I was getting a good grasp on.

      Yeah I think I’m gonna shit can Portainer and go through that LinkedIn course someone else posted. Thanks for your insight.

      • unscholarly_source@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Portainer is definitely useful (I use it on a daily basis), but probably a bad place to start…

        I started with the following progression:

        1. Docker CLI
        2. Docker-Compose
        3. Writing my own scripts to build and manage docker-compose configs (purely optional and skippable)
        4. Portainer
        5. Purely optional, but in a professional setting, kubernetes and various container orchestration tools.

        Good luck in your journey!

        • dartanjinn@lemm.eeOP
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          1
          ·
          1 year ago

          Docker-compose got it done. Once I learned about Volumes and using compose to pass in volumes from other instances I was able to pass in a directory with a custom yaml to the Dashy container then pass the same directory into the code-server container and both are working as I expected they should. Compose and volumes were the missing pieces. I also learned that stacks is how to use compose in Portainer. Not sure why they felt the need to change the naming but it works.

          • unscholarly_source@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            1 year ago

            That is AWESOME! Congrats!

            Yes that’s right, portainer stacks equate to compose… I might be wrong, but I remember reading somewhere a while back that they (and other container orchestration tools) were not permitted to reference “Docker” or its products (including compose) due to legal and licensing restrictions by Docker.

            Not to the level of Reddit, but Docker has its fair share of questionable business decisions.