Currently I’m planning to dockerize some web applications but I didn’t find a reasonably easy way do create the images to be hosted in my repository so I can pull them on my server.

What I currently have is:

  1. A local computer with a directory where the application that I want to dockerize is located
  2. A “docker server” running Portainer without shell/ssh access
  3. A place where I can upload/host the Docker images and where I can pull the images from on the “Docker server”
  4. Basic knowledge on how to write the needed Dockerfile

What I now need is a sane way to build the images WITHOUT setting up a fully featured Docker environment on the local computer.

Ideally something where I can build the images and upload them but without that something “littering Docker-related files all over my system”.

Something like a VM that resets on every start maybe? So … build the image, upload to repository, close the terminal window, and forget that anything ever happened.

What is YOUR solution to create and upload Docker images in a clean and sane way?

  • orizuru@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    1 year ago

    For the littering part, just type crontab -e and add the following line:

    @daily docker system prune -a -f
    
    • vegetaaaaaaa@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Careful this will also delete your unused volumes (not attached to a running container because it is stopped for whatever reason counts as unused). For this reason alone, always use bind mounts for volumes you care about.

      • orizuru@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Yes.

        All my self hosted containers are bound to some volume (since they require reading settings or databases).

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

          run docker without sudo.

          Doing that, you effectively give the user account root access without password

          docker run --volume /etc:/host_etc debian /bin/bash -> can read/write anything below the host’s /etc directory, including shadow file, etc.

          • orizuru@lemmy.sdf.org
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            1 year ago

            True.

            But I assume OP was already running docker from that user, so they are comfortable with those permissions.

            Maybe should have made it clearer. Added to my other post. Thanks!

      • orizuru@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        1 year ago

        Genuinely curious, what would the advantages be?

        Also, what if the Linux distro does not have systemd?

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

          I was just making a meme dude. Personally, I like systemd, it’s more complicated to learn, I ended up reading books to really learn it properly. There’s 100% nothing wrong with cron.

          One of the reasons I like timers is journalctl integration. I can see everything in one place. Small thing.

        • moonpiedumplings@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          The chances I am going to manage a linux distro without systemd are low, but some systems (arch for example) don’t have cron out of the box.

          Not that big of a deal since it’s easy to translate them all, but that’s one of the reasons why I default to systemd/timer units.