Docker

https://github.com/tborychowski/self-hosted-cookbook

Docker

Client - Server app (server is docker engine) via REST API can run containers (sharing kernel of host )
Create app image from: Dockerfile textfile with instructions » DockerImage (can get from docker hub)

Image

  • structure + metadata DockerImage

Container

  • process

Volumes

  • Host Volumes - -v /home/mount/data:/var/lib/mysql/data host:container - u decide where on host reference was made. whitch folder in host u mount in container
  • Anonymous Volumes -v /var/lib/mysql/data - Reference container directory. (docker sam wybiera )
  • Named volumes - -v name:/var/lib/mysql/data Anonymous but with name. (need to list 2 times in composer)

can mount same vol/ref to containers
https://youtu.be/p2PH_YPCsis?t=140

  • volume backup and restore: https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes

Backup volume

https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes


Container Management

Different ways to use docker:

Synology Docker

  • use visual docker to import DockerImages (ie, file, docker hub)
  • use ssh and docker comands

Desktop Docker

  • Windows docker app with WSL environment
  • To install:
    1. BIOS-level hardware virtualization support must be enabled in the BIOS settings VT-x / AMD-v / SVM Mode (M.I.T > advanced CPU Core settings) - Ctrl + Alt + delete to task manager can check if virtualisation = enable
    2. Instal WSL 2 - (via Power Shell wsl --install or Enable Hyper-V Windows Features) Windws subsystem for linux
      • Create UNIX user ….
    3. If not admin account: add the user to the docker-users group. (Computer Management as an administrator >Local Users and Groups > Groups > docker-users. RMB to add the user to the group. (logout/in)

WSL (Windows Subsystem for Linux)

  • Run docker throu Linux terminal
    1. Instal Windows subsys for linux
      • wsl --install
      • wsl --install -d Ubuntu
    2. enable wsl in docker settings

Yaht https://yacht.sh/docs/Installation/Getting_Started/

  • managemnet like Portrainer
  • To instal yacht
    docker volume create yacht
    docker run -d -p 8000:8000 -v /var/run/docker.sock:/var/run/docker.sock -v yacht:/config selfhostedpro/yacht
    

    USER: admin@yaht.local PASS: pass

Portrainer

https://www.youtube.com/watch?v=ZEy8iFbgbPA&t=192s


Create image from file

  • Create Dockerfile w no extension. Show wher source image is and dependences
    ARG  
    FROM  # require for start: name of files in dockerhub
    COPY . /usr/src/app... # 2 arguments  1. local json packaage location 2. place where to copy
    ENV #
    EXPOSE # expose port
    RUN # open terminal nad run  (SHELL FROM)
    CMD [ 'nmp' , 'start'] # commands  ONLY ONE PER FFILE (EXEC FROM)
    # CMD
    CMD ["executable","param1","param2"] (exec form, this is the preferred form)
    CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
    CMD command param1 param2 (shell form)
    
  • To create DockerImage out of steps from file:
    docker build -t fireship/demoapp:1.0 // -t tag << with username
    

Compose file

Structure commands - if more images Docker compose uses the Dockerfile if you add the build command to your project’s docker-compose.yml. Your Docker workflow should be to build a suitable Dockerfile for each image you wish to create

  • Create docker-compose.yml - in a root of a project (where dockerfile and .dockerignore are). keep all configuration for container. Docker Script
    version: '3' # which doce compose - leave always 3
    volumes:
    p4d_data: {}
    services:
    p4d:
      image: hawkmothstudio/helix-p4d
      build: helix-p4d
      ports:
        - '1666:1666'
      environment:
        P4USER: 'p4admin'
      volumes:   # (host existing in syunology (will change):: container folder  (same))
        - p4d_data:/data
    
  • compose
    docker-compose up -d
    

Terminal Commands

  • commands to manage
    docker # Available commands
    docker container ls # OLD version: `docker ps` # List running containers OLD !!!!
    docker images
    docker images build # build image from docker file        
    docker stop xxxxxxxxxxxx # container id
    docker image rm xxxxxxxxxxxx # remove by ID
    
  • docker image IMAGE
    docker image
    docker images ls # List
    docker images build # build image from docker file    
    docker images inspect
    docker images save # Save one or more images to a tar archive (streamed to STDOUT by default)
    
  • docker container CONTAINER
    docker container ls
    docker container rm
    docker container restart / pause / kill / run
    docker container export
    
  • docker build [OPTIONS] PATH | URL | - - BUILD
    docker build https://github.com/docker/rootfs.git#container:docker # 1. Git repositories
    docker build http://server/context.tar.gz # 2.  pre-packaged tarball contexts
    docker build github.com/creack/docker-firefox  # From file
    
    docker build -t foo . # build and tag in the 'name:tag' format
    docker build -f foo . # Name of the Dockerfile (Default is 'PATH/Dockerfile')
    
  • run
      docker run -d -p 80:80 docker/getting-started # -d = detache mode  80:80 - in/out ports  
    
  • docker volume
    docker volume ls
    
  • ..
      docker compose -v # version of DockerComposer
      docker compose config # Check if everything is ok
      docker run -d -p 80:80 docker/getting-started # -d = detache mode  80:80 - in/out ports  
      docker pull dunestorm/perforce # download docker hub file
    
  • inspect container
    sudo docker inspect e7ddd89307c1
    

How to:

Recreate Container

  1. instal docker and ssl to nas

  2. upload dockerfile

    FROM hawkmothstudio/helix-p4d
    
    • Terminal
      cd /volume1/docker/x   
      sudo docker build --tag x .  
      

Push / Pull

  • Pust to hub
    docker pull NAME:tag
    docker tag NAME:tag myaccount/name:tag
    docker login
    docker push myaccount/name:tag
    

compose build sudo docker-compose up --build

Audio liblary

  • uid / gid - uid=1026(MothRoot) gid=100(users) groups=100(users),101(administrators)

Music Servers

  • Navidrome / Jellyfin / plex / emby / Funkwhale / Airsonic, Subsonic / Lightweight Music Server(LMS) / mStream / Logitech Media Server / Audio synology / Others: Ampache, Koel, Music Player Daemon (MPD), Serviio, Sonixd / Modipy
  • Overview: https://github.com/basings/selfhosted-music-overview
Radio

ThRadio / Libretime / AzureCast, 2

https://www.navidrome.org/docs/getting-started/
https://demo.navidrome.org/
airsonic + subsonic https://www.navidrome.org/docs/usage/configuration-options/

https://www.youtube.com/c/DBTechYT/videos - ziomek od navidroma read only

seluan/navidrome:lastest
PYD PGID - permitions folder for config and music folders  
ports:  
restart:
environment:
volumes:
- "/path/to/data:/data"
- "/"

Errors

  • “docker build” requires exactly 1 argument. - sometimes need to add .
  • Got permission denied - use sudo

Manage music:

  • https://beets.io/

Docker

Docker Jellyfin

Libre Reader - books

LibreRead docker

Calibre Web - books

https://sasquatters.com/calibre-web-docker/




Perforce SETUP

LANG    en_US.UTF-8
LANGUAGE   en_US:en
LC_ALL    en_US.UTF-8
  • If you are working on Windows and versioning files on a Linux server, use case-insensitive mod.
  • Port forwarding on your router.

Configure Perforce Server

  • In NAS Docker Advanced settings
    • File/Folder Perforce/P4Server / Mount path /data
    • Locel Port 1666, Container Port 1666, Type TCP
  • In terminal add bash and:
    p4 info
    

p4 configure set dm.user.noautocreate=2
p4 user -f froyok
p4 password froyok
(p4 group -o p4users; echo " froyok") | p4 group -i
p4 users - to show info
type map: https://github.com/hawkmoth-studio/perforce-docker/blob/master/helix-p4d/p4-typemap/ue4.sample

=========================================================

SIECIOWE VOLUMY PRZEZ NFS

separate volume over gorsze: local or bind

migrate local docker volume to network storage

volume with /nfs/

https://www.youtube.com/watch?v=ZiwvZenOzto - temp some docker line commands
https://youtu.be/xzMhZoUs7uw?t=367 - temp instrukcja z folderami

gorsze
https://github.com/ambakshi/docker-perforce/tree/master/perforce-server
https://www.programmersought.com/article/29416846247/ - gorsza instalacja
https://aricodes.net/posts/perforce-server-with-docker/

P4

https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_user.html https://www.perforce.com/manuals/p4guide/Content/P4Guide/basic-tasks.recurring-file.add.html https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_user.html https://aricodes.net/posts/perforce-server-with-docker/


docker run -d –name=navidrome
-p 4533:4533 -e PUID=1026
-e PGID=100
-e ND_LOGLEVEL=info
-v /volume2/docker/navidrome:/data
-v /volume2/web/music:/music
– restart always
deluan/navidrome:lastest

$ docker run -d
–name navidrome
– restart=unless-stop
– user $(id -u):$(id -g)
-v /path/to/music:/music
-v /path/to/data:/
-p 4533:4533
-e ND_LOGLEVEL=info
deluan/navidrome:lastest

Zmienic sciezki na: /volume2/music