Docker and docker-compsoe known for its easy to use, and you can do so much with it. In simple docker is like container, each container has its own application running, whether it's nginx, morty or anything really. Each container has its own mapped volumes (locations) and it can share some volumes together if it has common running applications. I love docker because it makes it easy for me to put more than one service on the same server and manage them separately, so no conflicts.
In the following commands, I will assume you are using Debian.
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
So now it's time to learn some of the basic commands of docker-compode.
So go to directory where you currently have docker-compose.yml or docekr-compose.yaml and test these commands:
When you deal with docker in most, you will deal with docker-compose command line and a file called docker-compose.yaml. The idea is that docker-compose reads what is inside docker-compose.yaml (or docker-compose.yml) and then start the service, so you need to get familiar with that file and know what most data you need to change, for example in all of my upcoming wikis, you will, may need to change 2 or 3 things so let's take a look about them in this docker-compose file example so next time you see a file you will know what needed to change depending on your case.
version: "3" services: nitter: image: zedeus/nitter:latest container_name: nitter ports: - "127.0.0.1:8080:8080" # Replace with "8080:8080" if you don't use a reverse proxy volumes: - ./nitter.conf:/src/nitter.conf:ro depends_on: - nitter-redis restart: unless-stopped healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:8080/Jack/status/20 || exit 1 interval: 30s timeout: 5s retries: 2 nitter-redis: image: redis:6-alpine container_name: nitter-redis command: redis-server --save 60 1 --loglevel warning volumes: - nitter-redis:/data restart: unless-stopped healthcheck: test: redis-cli ping interval: 30s timeout: 5s retries: 2 volumes: nitter-redis:
This is a nitter compose file (nitter is front-end for twitter), in most part you will need to look for 2/3 things:
Ports: It's what port nitter will locally run, so if you already have another service running on the same port (8080 in this case) then feel free to change that port to another unused port.
volumes: Where files will be saved, for example your nitter config file will be saved in nitter.conf file (same folder you added docker-compose.yaml in), and here is an example for nitter.conf: https://github.com/zedeus/nitter/blob/master/nitter.example.conf.
And in some weird cases you might find something called environment variables, it's like config inside docker-compose file itself like in case of invidious for example or gitea as you see here in invidious:
version: "3" services: invidious: image: quay.io/invidious/invidious:latest # image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices restart: unless-stopped ports: - "127.0.0.1:3000:3000" environment: # Please read the following file for a comprehensive list of all available # configuration options and their associated syntax: # https://github.com/iv-org/invidious/blob/master/config/config.example.yml INVIDIOUS_CONFIG: | db: dbname: invidious user: kemal password: kemal host: invidious-db port: 5432 check_tables: true # external_port: # domain: # https_only: false # statistics_enabled: false healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 interval: 30s timeout: 5s retries: 2 depends_on: - invidious-db invidious-db: image: docker.io/library/postgres:14 restart: unless-stopped volumes: - postgresdata:/var/lib/postgresql/data - ./config/sql:/config/sql - ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh environment: POSTGRES_DB: invidious POSTGRES_USER: kemal POSTGRES_PASSWORD: kemal healthcheck: test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] volumes: postgresdata:
As you see something called environment and under it config or settings you can change as server owner so yup! In most parts you will need to look out for these 2 or 3 things, and if anything new I will mention it per service in my upcoming wikis.