GithubHelp home page GithubHelp logo

juanico10 / selfhosted Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 1.7 MB

Project to install Docker and Docker-Compose in Ubuntu, Raspberry or Nanopi

License: MIT License

Shell 79.34% Dockerfile 20.66%
docker docker-compose containers traefik nextcloud

selfhosted's Introduction

Docker container selfhosted

Project to install Docker and Docker-Compose in Ubuntu, Raspberry or Nanopi

Docker
Make your projects come to life with Docker

INSTALAR DOCKER EN UBUNTU

INSTALAR DOCKER

Primero, actualice su lista de paquetes existente:

sudo apt update

A continuaci贸n, instale algunos paquetes de requisitos previos que permitan a apt usar paquetes a trav茅s de HTTPS:

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

Luego, a帽ada la clave de GPG para el repositorio oficial de Docker en su sistema:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Agregue el repositorio de Docker a las fuentes de APT:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

A continuaci贸n, actualice el paquete de base de datos con los paquetes de Docker del repositorio reci茅n agregado:

sudo apt update

Por 煤ltimo, instale Docker:

sudo apt install docker-ce

Compruebe que funcione:

sudo systemctl status docker

Ejecutar el comando Docker sin sudo, si desea evitar escribir sudo al ejecutar el comando docker, agregue su nombre de usuario al grupo docker:

sudo usermod -aG docker ${USER}

Instalar Docker Compose

El siguiente comando descargar谩 la versi贸n 2.2.2 y guardar谩 el archivo ejecutable en /usr/local/bin/docker-compose, que har谩 que este software est茅 globalmente accesible como docker-compose, Si desea descargar la versi贸n m谩s reciente, ir al enlace: https://github.com/docker/compose/releases y modificar la versi贸n:

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Le damos permisos de ejecuci贸n:

sudo chmod +x /usr/local/bin/docker-compose

Para verificar que la instalaci贸n se realiz贸 correctamente, puede ejecutar:

docker-compose --version

INSTALAR DOCKER EN RASPBERRY O NANOPI

Preparaci贸n de la Raspberry Pi

Instalar los kernel-headers para el sistema operativo. Esto es importante, ya que si no instala los encabezados del kernel, Docker no funcionar谩.

sudo apt install raspberrypi-kernel raspberrypi-kernel-headers

INSTALAR DOCKER

Primero, actualice su lista de paquetes existente:

sudo apt update

A continuaci贸n, instale algunos paquetes de requisitos previos que permitan a apt usar paquetes a trav茅s de HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common
sudo apt install -y libffi-dev libssl-dev python3 python3-pip
sudo apt install iptables-persistent
sudo apt install unattended-upgrades

Por 煤ltimo, instale Docker:

sudo curl -sSL https://get.docker.com | sh

Compruebe que funcione:

sudo systemctl status docker

Ejecutar el comando Docker sin sudo, si desea evitar escribir sudo al ejecutar el comando docker, agregue su nombre de usuario al grupo docker:

sudo usermod -aG docker ${USER}

Instalar Docker Compose

El siguiente comando descargar谩 e instalar谩 docker-compose:

sudo apt install -y docker-compose

Para verificar que la instalaci贸n se realiz贸 correctamente, puede ejecutar:

docker-compose --version

CONTENEDORES DOCKER

  • traefik - reverse proxy and SSL manager.
  • Adguard - Network-wide ads & trackers blocking DNS server.
  • Grafana - The open-source platform for monitoring and observability.
  • Heimdall - Heimdall is an elegant solution to organise all your web applications.
  • Pihole - The Pi-hole庐 is a DNS sinkhole that protects your devices from unwanted content without installing any client-side software.
  • Portainer - Portainer is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments.
  • syncthing - Syncthing is a continuous file synchronization program.
  • wikijs - Wiki.js is an open source project that has been made possible due to the generous contributions by community backers.
  • fail2ban - security tool (ban IP).
  • freshrss - RSS feed aggregator.
  • gotify - notification service.
  • nextcloud - file-hosting software system.
  • transmission - fast, easy, and free BitTorrent client.
  • trilium - hierarchical note-taking application.
  • vaultwarden - password manager.
  • watchtower - automatic docker images update.
  • wireguard - Wireguard is a selfhosted vpn.
  • wordpress - WordPress is a blogging tool with a content management system (CMS).

Information

The overall guide is centered around example. Each of the services is tied with either a docker-compose or a script, everything has been made so that each service is almost ready to use, only a few user-specific variable are required.

All services respect a certain format :

  • About - basic overview of the service
  • Table of Contents
  • Information - detailed information about the service and the example
  • Usage - required configuration and commands to use the service
  • Update - how to update the container, most of the time it is using watchtower

Docker and UFW

UFW is a popular iptables front end on Ubuntu that makes it easy to manage firewall rules. But when Docker is installed, Docker bypass the UFW rules and the published ports can be accessed from outside.

An easy fix is available, allowing to easily manage your firewall. As most of the services are going through Traefik, only the port 443 is mandatory. If another port is required, it will be listed in the requirements.

Docker tips

  • Get shell access whilst the container is running
    docker exec -it container-name /bin/bash
    
  • Monitor the logs of the container in realtime
    docker logs -f container-name
    

Docker images

Most images are used with the tag latest as it simplify the testing. It is usually not recommended running an image with this tag as it is not very dynamic and precise. Feel free to experiment with the provided docker-compose examples and then use a better versionning system. For more information about latest.

Updating docker images

This repository images are automatically updated with watchtower, however this can be a security risk. More details in the watchtower guide.

If you want to manually update an image, you can use docker-compose.

  • Update all images for a specific docker-compose file
    sudo docker-compose pull
    
  • Update a single image
    sudo docker-compose pull image-name
    
  • Recreate all updated containers with docker-compose
    sudo docker-compose up -d
    
  • Recreate a single container with docker-compose
    sudo docker-compose up -d container-name
    
  • Remove all dangling and unused images
    sudo docker image prune  -a
    

Docker tools

Some useful tools to manage your private docker infrastructure.

  • lazydocker - A simple terminal UI for both docker and docker-compose, written in Go with the gocui library. By @jesseduffield
  • dive - A tool for exploring each layer in a docker image. By @anchore.
  • grype - A vulnerability scanner for container images and filesystems. By @anchore.

Docker resources

A compilation of resources mainly focus on security.

Credits

Buy me a coffee so I can continue creating content. Inv铆tame a un caf茅 para que pueda seguir creando contenidos.

Buy Me A Coffee

selfhosted's People

Contributors

juanico10 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.