• P1nkman@lemmy.world
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    23 hours ago

    I’m on a course to become full stack developer, and I know the command line (basics), have an old laptop running Linux Mint that I want to test to use as a docker, but I have no idea where to start.

    • dependencyinjection@discuss.tchncs.de
      link
      fedilink
      arrow-up
      18
      arrow-down
      2
      ·
      edit-2
      15 hours ago

      I am going to be pasting a set of commands to get docker and docker compose set up, but please be wary of people giving commands to run in the terminal. You could use the information I’ve provided to help you find guides to confirm that no weird commands, but I copied this from my guide I use whenever I set up a new VM to use docker.

      So the commands below add any dependencies for docker, adds the GPG key to verify and then installs docker and docker compose. I also set up a docker user add them to the docker group so I don’t need to use sudo to run.

      I then use docker to create a portainer instance. Portainer allows you to use a webUi to see what you have running and stop start any of your services from there.

      After this I have provided a docker compose file which would be named docker-compose.yml. Yaml sucks as it constantly moans about spacing, but essentially you want to use spaces and not tabs and each new line would be indented two spaces unless it’s a sub part of the section above then it would be two more spaces etc.

      This docker compose might or might not be what you need, this one first sets up gluetun, which is a VPN layer which I can route other services through as you don’t want to torrent from your IP.

      So gluetun is set up using ProtonVPN and you pass the username and password. Username has +pmp for port forwarding.

      Then each service under here can choose to use the service:gluetun or bridge network. The former is for the VPN the latter is routed through regular network. Notice how anything routed through the VPN has the ports defined in the VPN service.

      The others things you would need to be conscious of is the paths I have used for /mnt/vault/* as these are network attached storage from TrueNAS. Depending on how you want to store things you’ll need to just add the paths to these. The paths look weird but the part before the colon is where it is on your machine and the part after is what it is called inside that container.

      You’ll notice that Plex requires a claim key but you can google how to find that.

      This isn’t going to get you up and running and you will likely run in to permission errors and other errors along the way. I would suggest coming back here with your errors or giving them to ChatGPT, just don’t blindly copy commands if you don’t know what they do.

      Once your docker compose is complete you can run docker compose up -d to spin it up. Then in portainer you can see all the containers and then login to each and do the setup. Docker compose down to stop them all.

      When I set this up I did the gluetun and then Radarr. Get that working and then add your next thing and then the next and so on until you have what you want.

      As I said this isn’t a complete solution and you will run into roadblocks, but that’s the fun for me and I am happy to help when you get stuck along the way.

      Edit: A few more things you should know. The volumes section. The ones starting with ./ means they’re in the directory where the docker compose file is. And as I have perms to 1001 you would need to ensure that is the PUID of the docker user and then for each folder, plex for instance you can run “sudo chown -R 1001:1001 ./plex” and “sudo chmod-R 755 ./plex” which is change ownership and changes permissions for that directory.

      ### Docker

      Install dependencies

      `sudo apt install apt-transport-https ca-certificates curl software-properties-common -y`

      Add the Docker GPG key to the server’s keyring

      `sudo curl -fsSL https://download.docker.com/%E2%80%8Blinux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc`

      Add the latest Docker repository to the APT sources

      `echo “deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/​docker.asc] https://download.docker.com/%E2%80%8Blinux/ubuntu $(. /etc/os-release && echo “$VERSION_CODENAME”) stable” | sudo tee /etc/apt/sources.list.d/​docker.list > /dev/null`

      Update the server package index.

      `sudo apt update`

      Install Docker

      `sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin`

      Verify

      `sudo docker --version`

      Enable the Docker system service to start automatically at boot time.

      `sudo systemctl enable docker`

      View the Docker service status and verify that it’s running

      `sudo systemctl status docker`

      #### Install docker compose

      `sudo apt install docker-compose-plugin -y`

      Verifiy the installation

      `docker compose version`

      #### Portainer

      Create a Volume for Portainer Data

      `docker volume create portainer_data`

      Deploy Portainer as a Container

      ```

      docker run -d \

      –name=portainer \

      –restart=always \

      -p 8000:8000 \

      -p 9443:9443 \

      -v /var/run/docker.sock:/var/run/​docker.sock \

      -v portainer_data:/data \

      portainer/portainer-ce:latest

      ```

      Acess Portainer

      `https://your-server-ip:9443`

      #### Running Docker without Sudo

      Add your user to the docker group:

      `sudo usermod -aG docker $USER`

      Log out and log back in, or restart your system.

      Verify by running:

      `docker ps`

      Below is the docker-compose.yml file.

      services:
        gluetun:
          image: qmcgaw/gluetun
          container_name: protonvpn
          cap_add:
            - NET_ADMIN
          devices:
            - /dev/net/tun:/dev/net/tun
          ports: # These are the qBittorrent ports, I like to use random ports and not the default ports 49152
            - 49893:49893 # This is for the qBittorrent WebUI Port
            - 6881:6881 # Listening port for TCP
            - 6881:6881/udp # Listening port for UDP
            - 7878:7878 # Listening port for Radarr
            - 8989:8989 # Listening port for Sonarr
            - 9696:9696 # Listening port for Proxlarr
          environment:
            - VPN_SERVICE_PROVIDER=protonvpn
            - OPENVPN_USER=USERNAME+pmp # REPLACE with your OpenVPN username (+pmp for port forwarding)
            - OPENVPN_PASSWORD=PASSWORD # REPLACE with your OpenVPN password
            - VPN_PORT_FORWARDING=on
            - SERVER_COUNTRIES=France # These countries must support P2P
          volumes:
            - ./gluetun:/gluetun
          restart: unless-stopped

        qbittorrent:
          image: lscr.io/linuxserver/​qbittorrent:latest
          container_name: qbittorrent
          environment:
            - PUID=1001 # to find your current ID just type “id” in the terminal
            - PGID=1001 # to find your current group ID just type “id” in the terminal
            - TZ=Europe/London
            - WEBUI_PORT=49893 # Must match the port used on gluetun for the WebUI
            - TORRENTING_PORT=6881
          volumes:
            - ./qbittorent/config:/config # this will create the config folder in the same folder as the yml file
            - /mnt/vault/Downloads:/​downloads # adjust to your desired download directory
          network_mode: “service:gluetun” # must match the container name of gluetun
          restart: unless-stopped

        prowlarr:
          image: lscr.io/linuxserver/prowlarr:​latest
          container_name: prowlarr
          depends_on:
            - gluetun
          environment:
            - PUID=1001
            - PGID=1001
            - TZ=Europe/London
          user: “1001:1001”
          volumes:
            - ./prowlarr/config:/config
          network_mode: “service:gluetun”
          restart: unless-stopped

        radarr:
          image: lscr.io/linuxserver/radarr
          container_name: radarr
          depends_on:
            - gluetun
          environment:
            - PUID=1001
            - PGID=1001
            - TZ=Europe/London
          user: “1001:1001”
          volumes:
            - ./radarr/config:/config
            - /mnt/vault/Downloads:/​downloads
            - /mnt/vault/Movies:/movies
          network_mode: “service:gluetun”
          restart: unless-stopped

        sonarr:
          image: lscr.io/linuxserver/sonarr
          container_name: sonarr
          depends_on:
            - gluetun
          environment:
            - PUID=1001
            - PGID=1001
            - TZ=Europe/London
          user: “1001:1001”
          volumes:
            - ./sonarr/config:/config
            - /mnt/vault/Downloads:/​downloads
            - /mnt/vault/TV:/tv
          network_mode: “service:gluetun”
          restart: unless-stopped

        jellyfin:
          image: jellyfin/jellyfin
          container_name: jellyfin
          environment:
            - PUID=1001
            - PGID=1001
            - TZ=Europe/London
          volumes:
            - ./jellyfin/config:/config
            - /mnt/vault/Movies:/movies
            - /mnt/vault/TV:/tv
          restart: unless-stopped
          ports:
            - 8096:8096
          network_mode: “bridge”

        plex:
          image: lscr.io/linuxserver/plex:​latest
          container_name: plex
          network_mode: host
          environment:
            - PUID=1001
            - PGID=1001
            - TZ=Europe/London
            - VERSION=docker
            - PLEX_CLAIM=CLAIMKEY
            - NVIDIA_VISIBLE_DEVICES=all
          volumes:
            - ./plex:/config
            - /mnt/vault/Movies:/movies
            - /mnt/vault/TV:/tv
          deploy:
            resources:
              reservations:
                devices:
                  - driver: nvidia
                    count: all
                    capabilities: [gpu]
          runtime: nvidia
          restart: unless-stopped

        • dependencyinjection@discuss.tchncs.de
          link
          fedilink
          arrow-up
          2
          ·
          17 hours ago

          This isn’t likely to work without some whack a mole with errors though but it should be enough for someone curious enough to be able to get a working solution.

          My NAS currently has a sole 10TB HDD and funds are too low to justify an additional one so I am very nervous.

    • Snoopey@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      1
      ·
      edit-2
      21 hours ago

      You could follow a guide to install portainer, it’s got a web gui to manage docker. It can handle installing most types of docker containers.

      When you find a cool project to install, they almost always have a docker compose template you can use to install their container.

      The docker compose tells docker which containers to install and how they might rely on each other as well as which ports to run on and where all their config and/or data files should be stored.

      Using a docker compose makes things super simple to update by using portainer to repull the images to the latest versions and run those. The new containers running the new versions will have all the same config and see the same data/config directories that you specify in the docker compose.

      I run a bunch of containers, some good examples are the ARR stack to download tv shows and movies. Radarr, Sonarr, Prowlarr, Transmission are all defined in one docker compose. Another couple of great containers I run are Actual Budget for budgeting software and Tandoor for saving and managing recipes and grocery lists. Actual Budget and Tandoor have their own docker compose configs.