Docker Praxistraining für (Web) Entwickler

March 21 @ 09:00 March 22 @ 16:00

Schulung / Training / Kurs / Seminar – 2 Tage remote

Das sich mit Docker auf sehr effiziente Weise Arbeitsumgebungen für Entwickler bereitstellen lassen hat sich bereits herumgesprochen. Wie eine solche Arbeitsumgebung aber auf dem eigenen Entwicklungsrechner effizient und zeitsparend aufgebaut und betrieben wird, lernen sie in diesem Kurs von Grund auf.

Das Praxisbeispiel führt Sie Schritt für Schritt hin zu einer vollwertigen Programmierumgebung für PHP Webprojekte, einem sogenannten LAMP Stack. Während Sie die Dienste Apache 2 HTTP Webserver mit PHP und einer MySQL Datenbank, sowie dem Administrationswerkzeug PhpMyAdmin über Docker Container erstellen, lernen Sie nebenher alle wichtigen Grundlagen zu Docker, um künftig auch anders gestaltete Entwicklungsumgebungen erstellen zu können.

Profitieren sie von den vielen Vorteilen die Ihnen Docker auch in den Entwickleralltag bringt. Gekapselte parallele Installationen die sich leicht aktualisieren lassen und zudem noch wetvolle Systemressourcen schonen. Nutzen Sie die eingesparte Zeit um sich mit den wirklich wichtigen Dingen beschäftigen zu können, dem programmieren.

Durchführungs-Garantie: der Kurs wird auch bei nur einem Teilenmenden durchgeführt

Kurs buchen: https://www.gfu.net/seminare-schulungen-kurse/open_source_sk62/docker-praxistraining-fuer-web-entwickler_s2665.html

Jeder Teilenmende erhält eine gedruckte Ausgabe des Buches: Marco Schulz, CI mit Jenkins, Rheinwerk, 2021

Sollten Sie zu den angebotenen Terminen nicht können, beziehungsweise für Ihr Team einen individuellen Termin wünschen, um beispielsweise in einer geschlossenen Runde auf konkrete Problemstellungen eingehen zu können, besteht die Möglichkeit zusätzliche außerplanmäßige Termine zu vereinbaren. Nutzen Sie bitte hierzu mein Kontaktformular unter der Angabe welchen Kurs Sie wünschen, mit Terminvorschlägen und der zu erwartenden Teilnehmerzahl.

Weitere Termine:

  • 20.06 – 21.06.2024
  • 03.09.-04.09.2024
  • 28.11.-29.11.2024
  • 09.01.-10.01.2025
  • 02.04.-03.04.2025
  • 17.07.-18.07.2025

Git: Überblick für Entwickler

May 23 @ 09:00 May 24 @ 16:00

Schulung / Training / Kurs / Seminar – 2 Tage remote

In dem Seminar “Git für Entwickler” erlernen Sie die Grundlagen und die Verwendung von Git, dem führenden Versionskontrollsystem für Softwareentwicklung. Git ist für fast alle Sprachen nutzbar und kostenlos verwendbar.

Durchführungs-Garantie: der Kurs wird auch bei nur einem Teilenmenden durchgeführt

Kurs buchen: https://www.gfu.net/seminare-schulungen-kurse/testmanagement_sk92/git-fuer-entwickler_s2556.html

Jeder Teilenmende erhält eine gedruckte Ausgabe des Buches: Marco Schulz, CI mit Jenkins, Rheinwerk, 2021

Sollten Sie zu den angebotenen Terminen nicht können, beziehungsweise für Ihr Team einen individuellen Termin wünschen, um beispielsweise in einer geschlossenen Runde auf konkrete Problemstellungen eingehen zu können, besteht die Möglichkeit zusätzliche außerplanmäßige Termine zu vereinbaren. Nutzen Sie bitte hierzu mein Kontaktformular unter der Angabe welchen Kurs Sie wünschen, mit Terminvorschlägen und der zu erwartenden Teilnehmerzahl.

Weitere Termine:

  • 15.08 – 16.08.2024
  • 21.11 – 22.11.2024
  • 23.09.-27.09.2024
  • 21.11.-22.11.2024
  • 10.02.-11.02.2025
  • 19.05.-20.05.2025
  • 04.08.-05.08.2025

Understanding Linux: rediscovering the joy of technology

Since Windows 10 users losing more and more control over their systems. The keyword is governance where companies try to educate their users. Don’t worry I will not give a huge speech about the free of will and evil tech companies. In this article I give you an opportunity to take back control of your computing device. Say goodbye to Microsoft and Windows and begin your journey with Linux.

Around the year 2015 I took a decision to get rid of Microsoft windows and move to 100% to Linux. I already had at this time several experiences with Linux on the server side. But use Linux daily on your desktop for all the tasks was a new challenge, because the tings are different. So I spended around 4 weeks and several tries to find a Linux desktop distribution which fits as best to my needs. The things you need to pay attention to the best result for yourself is the availability of a huge software repository where you can get all the applications you need. Another important point is the look and feel of your desktop. Here are also several options you can choose from. Before I give a brief overview about distributions and desktops I will explain the problem of software versions and repositories.

A software repository is just a big storage were the binaries and installers for your application is placed. If you decided for a distribution and a specific version you have a defined repository where you are able to purchase you software and distribution updates. Let’s assume we have a Linux distribution with a version from 2019. The support for this version is let’s say is until 2020. That means for the software repository the included software just contains a state from this time. If you wish to have for this distribution the newest GIMP version like 2.10.36 from November 2023 you can not get it from your original distribution repository. The last software version for GIMP in the original repository is the version from 2020. The same problem is with older software versions. This is a very specific problem for software developers and available programming languages. If you need to maintain old PHP or JAVA applications you need very specific compilers and interpreters they may not included in your software repository. To solve this problem it exist several solutions. Developers for example can use Docker. As a regular user you can try to get older or newer versions of a software directly from the Developer / Manufacturer. With this knowledge we can now learn what is a distribution and which ones existing.

If you want to choose for you a Linux distribution or in short Distro you have a huge selection where to choose from. But what is a Distro? In general you can say that a manufacturer put together a Linux Kernel, a collection of software and a repository and decorate everything with his own look and feel. It is also possible that you create your own Linux, including compiling your own kernel. But Linux is not in all the cases Linux. We need to distinguish between Linux and Unix. Linux is a derivation of Unix, like the Name LinUx as a combination from Linus and Unix already suggest. The big difference between Linux and Unix are the network functionality, which is in Unix more advanced. The operation System (OS) from Apple for example is based on Unix. A very common Unix OS is FreeBSD. BSD means Barkley Software Distribution and is continuous developed by the Barkley University in California.

0
Rate your favorite Linux Distribution

Beside this distinguish exist tree main Linux branches which also includes more derivation. As first there is from Germany Suse with the YAST packet manger for their software repositories. By the way Suse 7.2 was my first desktop tryout in 2002. Suse is not so common and sometimes is very hard to find for special questions or problems sufficient content. Another Distro comes from Red Hat, an Open Source pioneer. RHEL or Red Hat Enterprise Linux is a commercial Linux server distribution. The reason for a commercial Linux relies on the existence of server productive systems. With a RHEL license companies get from Red Hat a professional support in the case of emergencies. The Red Hat Desktop is not anymore supported and transformed to Fedora Linux. The default packet manger for their software repositories is YUM. The last but not least branch of the main Linux Distros is Debian with a huge brunch of Sub-Distros. All those popular beginner Distros like Linux Mint, Ubuntu or Zorin OS are based on Debian. When I changes in 2015 to Linux Desktop I started with Ubuntu Mate LTS and since end of 2023 I switched to Debian 12 with a Gnome 3 Desktop. The default packet manager for Debian systems is APT. Ubuntu introduced in 2023 their own SNAP packet Manager.

Another important term in the Linux universe is the Desktop manager. Here you can choose from: KDE, Gnome, Mate, XFCE and Cinnamon. Like my list of Distros the list of available Dektops is also not complete. I just mention the most common. The most Linux Distros comes with several Desktop manager by default. You can choose during the Login procedure which Dektop you like to use. So you have an easy way to try out which Desktop fits you as best. Later when you more experienced and you already nailed your choice for your daily work you can deselect unwanted Desktops during the installation process to save a bit of disk space.

Many people recommend new Linux users an Ubuntu distribution with the argumentation is more easy for the beginning. They give hits like that you can switch to Debian later when you more experienced. I have there a complete different opinion. The complication on Linux is not the Distro it is the Dektop. Ubuntu / Debian have a very good community and documentation. If you need to fix a problem you will find some help. This is why it is important to know of which family your Distro is based on, to search for help. Before you start with things like multi or dual boot. Create your an virtual machine with the Linux you wish to try. Like this you learn something about the installation process and file system.

The most difficult thing in the early beginning of my Linux adventures was to understand where the things get stored. For example 3rd party software usually got installed into the directory opt. Complicated is also the permission system for files and directories on ext3 / ext4. This concept don’t exist on Windows FAT or NTFS file system. Don’t worry about that. During your daily work you will figure out very fast how it goes.

Microsoft Surface 3 PRO with Ubuntu Linux

When I tied out the first time Ubuntu it was around 2010 where canonical the distributor of Ubuntu introduced by default the UNITY Desktop. I was not liked because it contains a lot of advertising and unwanted Apps like Spotify and Facebook. I figured out that Ubuntu has a Version with a Gnome Dektop Clone called Mate. I decided to try and I liked from the first moment. After the first Installation on my Laptop in 2015 I was needed until 2023 only 2 times to install Ubuntu new on my system. The reasons was I replaced my internal SSD first to 1 TB later to 2TB. No issues that the systems slowed down or the disk messed up with orphan files. No regular cleanup and service tasks like they are common in windows. The system just worked stable without serious crashes. I also never had any issues with hardware drivers. AL my new components always got detected correctly from linux and often exist little administration tools. Stremdeck UI or Noson for Sonos Speaker for example. When I got my new Laptop in December 2023 I decided to move from Ubuntu to the original. Because Ubuntu is made from a company and often they decide to go their own way. Who knows if they in the future transform to a Microsoft behavior. I prefer always to do my transition early without pressure to be prepared before I don’t have any other choice.

Of course I use an Antivirus and a Firewall on my system. Because Linux is not free against bad attacks, so there also necessities for protection.

A lot of people messing up with changing from Microsoft Office to Libre Office. The really secret to do not loose you layout is take care on the Fonts. When your MS Office original documents using the default Microsoft Fonts you need to install them also on your Linux machine to not destroy the office document layout.

For me is no real necessity to move back to Windows. Well I’m not a gamer but also for this exist plenty solutions. Steam is also available on Linux. The most persons I know they don’t even play anymore on PC or Laptops, they prefer Consoles like PlayStation. For me Linux is cool because I have full control over my system, its free and I can customize as I want. If you have an old Laptop which is not performing anymore with Windows try to install a Linux and enjoy.

Wind of Change – a journey to Linux

When friends or colleagues complain about their systems, I always recommend them Linux. But guess...

Understanding Linux: rediscovering the joy of technology

It's time to take control of your hardware again, because you don't have to be...

Network spy protection with AdGuard Home on a Raspberry Pi and Docker

In this short tutorial I describe how you are able to setup AdGuard Home on...

Learn to walk with Docker and PostgreSQL

After some years the virtualization tool Docker proofed it's importance for the software industry. Usually...

Installing NextCloud with Docker on a Linux Server

On our first LiveStream we explain shortly what is Docker and how fast it can...

How to reduce the size of a PDF document

When you own a big collection of PDF files the used storage space can increasing...

Goodbye privacy, goodbye liberty

The new terms of conditions for Microsoft services released on October 2023 caused an outcry in the IT world. The reason was a paragraph who said, that now all Microsoft Services are powered by artificial intelligence. This A. I. supposed to be used to detect copyright violations. This includes things like Music, Movies, Graphics, E-Books and Software. In the case this A. I. Detect copyright violations on your system, those files supposed to got deleted automatically from the ‘system’. At this time it is not clear if this rule applies to your own local disk storage or just to the files on the Microsoft Cloud. Microsoft also declared that user which violates the copyright rule will be suspended from all Microsoft Services.

This exclusion has different flavors. The first questions rise up to my mind is what will happened with paid subscriptions like Skype? They will block me and refund my unused credits? A more worst scenario is may I will loose also all my credits and digital properties like access to games and other things. Or paid subscriptions will not be affected? Until now this part not clear.

If you are an Apple user my you could think this things will not affect you but better be sure you may use a Microsoft Service you don’t know its Microsoft. Not every Product include the companies name. Think about it, because who knows if those products spying around on your system. Some applications like Skype, Teams, Edge Browser and Visual Studio Code are available for other platforms like Apple and Linux.

Microsoft also owned the Source Code hosting Platform GitHub and an social network for professionals called LinkedIn. Whit Office 360 you can use the entire Microsoft Office Suite via Web Browser as Cloud solution and all your documents will be stored in the Microsoft Cloud. The same Cloud where US Government institutions like the CIA, NSA and many others keep their files. Well seems it will be a secure place for all your thought you place inside a office document.

This small detail about Office documents leads us to a little side note in the new terms of condition from Microsoft. The fight against hate speech. Whatever that means. Public insults and defamation have always been strictly enforced by the legislature. This means that it is not a trivial offense but rather a criminal offense. So it’s not clear to me what all this talk about hate speech means. Maybe it’s an attempt to introduce public censorship of freedom of expression.

But well back to the side notice from Microsoft term of conditions about hate speech. Microsoft wrote something like: if we detect hate speech we will warn the user and if the violations occur several times the Microsoft account of the user will be deactivated.

If you may think this is just something happen now by Microsoft, be sure many other companies working to introduce equal services. The communication platform Zoom for example included also A. I. techniques to observe the user communication for training purposes.

With all those news is still a big questions needed to be answered: What can I do by myself? The solution is simple. Move back from the digital universe into the real world. Turn the brain back on. Use pen and paper, pay in cash, leave your smartphone at home and there never on the bedside table. If you don’t use it turn it off. Meet your friend physically when ever it is possible and don’t bring your smartphone. There will be no government, no president and no messiahs to bring a change. It’s up to us.

Wind of Change – a journey to Linux

When friends or colleagues complain about their systems, I always recommend them Linux. But guess...

Understanding Linux: rediscovering the joy of technology

It's time to take control of your hardware again, because you don't have to be...

Network spy protection with AdGuard Home on a Raspberry Pi and Docker

In this short tutorial I describe how you are able to setup AdGuard Home on...

Learn to walk with Docker and PostgreSQL

After some years the virtualization tool Docker proofed it's importance for the software industry. Usually...

Installing NextCloud with Docker on a Linux Server

On our first LiveStream we explain shortly what is Docker and how fast it can...

How to reduce the size of a PDF document

When you own a big collection of PDF files the used storage space can increasing...

Grazer Linux Tage 2022

April 23, 2022 All day

Heimnetz ohne Werbung mit AdGuard auf dem RaspberryPI

Leider ist von Minute 1:00 bis 2:10 kein Tonmitschnitt vorhanden 🙁 – einfach überspringen

Es gibt viele Projekte die sich für einen Raspberry PI eignen. Aus eigener Anwendung zeige ich wie man im Heimnetzwerk das Tool AdGuard in einem Docker Container zum laufen bringt, um damit die Werbung für alle im Netwerk verbundenen Geräte abstellt.

In diesem kleinen Workshop geht es darum auf einem Raspberry PI 4 mit einem Ubuntu Server Docker zum Laufen zu bekommen. Das ist aber der einfachste Schritt, denn dann geht es ans Eingemachte und wir fühlen den Netzwerkmöglichkeiten von Docker ein wenig auf den Zahn. Ein bischen SSH und Shell, ganiert mit Routerkonfiguration und vielen kleine praktischen Tipps runden den Talk ab.

Working with textfiles on the Linux shell

Linux turns more and more to a popular operating system for IT professional. One of the reasons for this movement are the server solutions. Stability and low resource consuming are some of the important characteristics for this choice. May you already played around with a Microsoft Server you will miss the graphical Desktop in a Linux Server. After a login into a Linux Server you just see the command prompt is waiting for your inputs.

In this short article I introduce you some helpful Linux programs to work with files on the command line. This allows you to gather information, for example from log files. Before I start I’d like to recommend you a simple and powerful editor named joe.

Ctrl + C – Abort the current editing of a file without saving changes
Ctrl + KX – Exit the current editing and save the file
Ctrl + KF – Find text in the current file
Ctrl + V – Paste clipboard into document (CMD + V for Mac)
Ctrl + Y – Delete current line where cursor is

To install joe on an Debian based Linux distribution you just need to type:

sudo apt-get install joe

1. When you need to find content in a huge text file GREP will be your best friend. GREP allows you to search for text pattern in files.

gerp <pattern> file.log
    -n : number of lines that matches
    -i : case insensitive
    -v : invert matches
    -E : extended regex
    -c : count number of matches
    -l : find filenames that matches the pattern

Bash

2. When you need to analyze network packages NGREP is the tool of your choice.

ngrep -I file.pcap
    -d : specify the network interface
    -i : case insensitive
    -x : print in alternate hexdump
    -t : print timestamp
    -I : read a pcap file

Bash

3. When you need to see the changes between two versions of a file, DIFF will do the job.

diff version1.txt version2.txt
    -a : add
    -c : change
    -d : delete
     # : line numbers
     < : file 1
     > : file 2

Bash

4. Sometimes it is necessary to give an order to the entries in a file. SORT is gonna to help you with this task.

sort file.log 
     -o : write the result to a file
     -r : reverse order
     -n : numerical sort
     -k : sort by column
     -c : check if orderd
     -u : sort and remove
     -f : ignore case
     -h : human sort

Bash

5. If you have to replace Strings inside of a huge text, like find and replace you can do that with SED, the stream editor.

sed s/regex/replace/g
     -s : search
     -g : replace
     -d : delete
     -w : append to file
     -e : execute command
     -n : suppress output

Bash

6. Parsing fields using delimiters in text files can done by using CUT.

cut -d ":" -f 2 file.log
     -d : use the field delimiter
     -f : field numbers
     -c : specific characters position

Bash

7. The extraction of substrings who occurred just once in a text file you will reach with UNIQ.

uniq file.txt
     -c : count the numbers of duplicates
     -d : print duplicates
     -i : case insesitive

Bash

8.  AWK is a programming language consider to manipulate data.

awk {print $2} file.log

Bash

Wind of Change – a journey to Linux

When friends or colleagues complain about their systems, I always recommend them Linux. But guess...

Understanding Linux: rediscovering the joy of technology

It's time to take control of your hardware again, because you don't have to be...

Network spy protection with AdGuard Home on a Raspberry Pi and Docker

In this short tutorial I describe how you are able to setup AdGuard Home on...

Learn to walk with Docker and PostgreSQL

After some years the virtualization tool Docker proofed it's importance for the software industry. Usually...

Installing NextCloud with Docker on a Linux Server

On our first LiveStream we explain shortly what is Docker and how fast it can...

How to reduce the size of a PDF document

When you own a big collection of PDF files the used storage space can increasing...

How to reduce the size of a PDF document

When you own a big collection of PDF files the used storage space can increasing quite high. Sometimes I own PDF documents with more than 100 MB. Well nowadays this storage capacities are not a big issue. But if you want to backup those files to other mediums like USB pen drives or a DVD it would be great to reduce the file size of you PDF collection.

Long a go I worked with a little scrip that allowed me to reduce the file size of a PDF document significantly. This script called a interactive tool called PDF Sam with some command line parameters. Unfortunately many years ago the software PDF Sam become with this option commercial, so I was needed a new solution.

Before I go closer to my approach I will discuss some basic information about what happens in the background. As first, when your PDF blew up to a huge file is the reason because of the included graphics. If you scanned you handwritten notes to save them in one single archive you should be aware that every scan is a image file. By default the PDF processor already optimize those files. This is why the file size almost don’t get reduced when you try to compress them by a tool like zip.

Scanned images can optimized before to include them to a PDF document by a graphic tool like Gimp. Actions you can perform are reduce the image quality and increase the contrast. Specially for scanned handwritten notes are this steps important. If the contrast is very low and maybe you plan to print those documents, it could happens they are not readable. Another problem in this case is that you can’t apply a text search over the document. A solution to this problem is the usage of an OCR tool to transform text in images back to real text.

We resume shortly the previous minds. When we try to reduce the file size of a PDF we need to reduce the quality of the included images. This can be done by reducing the amount of dots per inch (dpi). Be aware that after the compression the image is still readable. As long you do not plan to do a high quality print like a magazine or a book, nothing will get affected.

When we wanna reduce plenty PDF files in a short time we can’t do all those actions by hand. For instance we need an automated solution. To reach the goal it is important that the tool we use support the command line. The we can create a simple batch job to perform the task without any hands on.

We have several options to optimize the images inside a PDF. If it is a great idea to perform all options, depend on the purpose of the usage.

  1. change the image file to the PNG format
  2. reduce the graphic dimensions to the real printable area
  3. reduce the DPI
  4. change the image color profile to gray-scale

As Ubuntu Linux user I have all of the things I need already together. And now comes the part that I explain you my well working solution.

Ghostscript

GPL Ghostscript is used for PostScript/PDF preview and printing. Usually as a back-end to a program such as ghostview, it can display PostScript and PDF documents in an X11 environment.

If you don’t have Ghostscript installed on you system, you can do this very fast.

sudo apt-get update
sudo apt-get -y install ghostscript

Bash

 Before you execute any script or command be aware you do not overwrite with the output the existing files. In the case something get wrong you loose all originals to try other options. Before you start to try out anything backup your files or generate the compressed PDF in a separate folder.

gs -sDEVICE=pdfwrite \
   -dCompatibilityLevel=1.4 \
   -dPDFSETTINGS=/default \
   -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages \
   -dCompressFonts=true \
   -r150 \
   -sOutputFile=output.pdf input.pdf

Bash

The important parameter is r150, which reduce the output resolution to 150 dpi. In the manage you can check for more parameters to compress the result more stronger. The given command you are able to place in a script, were its surrounded by a FOR loop to fetch all PDF files in a directory, to write them reduced in another directory.

The command I used for a original file with 260 MB and 640 pages. After the operation was done the size got reduced to around 36 MB. The shrunken file is almost 7 times smaller than the original. A huge different. As you can see in the screenshot, the quality of the pictures is almost identical.

As alternative, in the case you won’t come closer to the command line there is a online PDF compression tool in German and English language for free use available.

PDF Workbench

Linux Systems have many powerful tools to deal with PDF documents. For example the Libreoffice Suite have a button where you can generate for every document a proper PDF file. But sometimes you wish to create a PDF in the printing dialog of any other application in your system. With the cups PDF print driver you enable this functionality on your system.

sudo apt-get install printer-driver-cups-pdf

Bash

As I already explained, OCR allows you to extract from graphics text to make a document searchable. When you need to work with this type of software be aware that the result is good, but you cant avoid mistakes. Even when you perform an OCR on a scanned book page, you will find several mistakes. OCRFeeder is a free and very powerful solution for Linux systems.

Another powerful helper is the tool PDF Arranger which allows you to add or remove pages to an existing PDF. You are also able to change the order of the pages.

Resources

Installing NextCloud with Docker on a Linux Server

For business it’s sometime important to have a central place where employees and clients are able to interact together. NextCloud is a simple and extendable PHP solution with a huge set of features you can host by yourself, to keep full control of your data. A classical Groupware ready for your own cloud.

If you want to install NextCloud on your own server you need as first a well working PHP installation with a HTTP Server like Apache. Also a Database Management System is mandatory. You can chose between MySQL, MariaDB and PostgreSQL servers. The classical way to install and configure all those components takes a lot of time and the maintenance is very difficult. To overcome all this we use a modern approach with the virtualization tool docker.

The system setup is as the following: Ubuntu x64 Server, PostgreSQL Database, pgAdmin DBMS Management and NextCloud.



Agenda

  • Docker Basics
  • Installing Docker on a Ubuntu server
  • prepare your database
  • putting all together and make it run
  • insights to operate NextCloud

Docker Container Instructions

# create network
docker network create -d bridge --subnet=172.18.0.0/16 service

# postures database server
docker run -d --name postgres --restart=always \
--net service --ip 172.18.0.2 \
-e POSTGRES_PASSWORD=s3cr3t \
-e PGPASSWORD=s3cr3t \
-v /home/ed/postgres/data:/var/lib/postgresql/data \
postgres:11.1

# copy files from container to host system
docker cp postgres:/var/lib/postgresql/data /home/ed/postgres

# pgAdmin administration tool
docker run -d --name pgadmin --restart=no \
-p 8004:80 --net services --ip 172.18.0.3 \
-e PGADMIN_DEFAULT_EMAIL=account@sample.com \
-e PGADMIN_DEFAULT_PASSWORD=s3cr3t \
dpage/pgadmin4:5.4

# nextcloud container
docker run -d --name nextcloud --restart=always \
-p 8080:80 --net services --ip 172.18.0.4 \
-v /home/ed/_TEMP_/nextcloud:/var/www/html \
-e POSTGRES_DB=nextcloud \
-e POSTGRES_USER=nextcloud \
-e POSTGRES_PASSWORD=nextcloud \
-e POSTGRES_HOST=172.18.0.2 \
nextcloud:22.2.0-apache

Bash

If you have any question feel free to leave a comment. May you need help to install and operate your own NextCloud installation secure, don’t hesitate to contact us by the contact form. In the case you like the video level a thumbs up and share it.

Resources

Links sind nur für eingeloggte Nutzer sichtbar.

Learn to walk with Docker and PostgreSQL

After some years the virtualization tool Docker proofed it’s importance for the software industry. Usually when you hear something about virtualization you may could think this is something for administrators and will not effect me as a developer as much. But wait. You’re might not right. Because having some basic knowledge about Docker as a developer will helps you in your daily business.

Step 0: create a local bridged network

docker network create -d bridge --subnet=172.18.0.0/16 services

Bash

The name of the network is services an bind to the IP address range 172.18.0.0 to 172.18.0.255. You can proof the success yourself by typing:

docker network ls

Bash

An output like the one below should appear:

NETWORK ID     NAME       DRIVER    SCOPE
ac2f58175229   bridge     bridge    local
a01dc5513882   host       host      local
1d3d3ac42a40   none       null      local
82da585ee2df   services   bridge    local

Bash

The network step is important, because it defines a permanent connection, how applications need to establish a connect with the PostgreSQL DBMS. If you don’t do this Docker manage the IP address and when you run multiple containers on your machine the IP addresses could changed after a system reboot. This depends mostly on the order how the containers got started.

Step 1: create the container and initialize the database

docker run -d --name pg-dbms --restart=no \
--net services --ip 172.18.0.20 \
-e POSTGRES_PASSWORD=s3cr3t \
-e PGPASSWORD=s3cr3t \
postgres:11

Bash

If you wish that your PostgreSQL is always up after you restart your system, you should change the restart policy form no to always. The second line configure the network connection we had define in step 0. After you created the instance pg-dbms of your PostgreSQL 11 Docker image, you need to cheek if it was success. This you can do by the

docker ps -a

Bash

command. When your container is after around 30 seconds still running you did everything right.

Step 2: copy the initialized database directory to a local directory on your host system

docker cp pg-dbms:/var/lib/postgresql/data /home/ed/postgres

Bash

The biggest problem with the current container is, that all data will got lost, when you erase the container. This means wen need to find a way how to save this data permanently. The easiest way is to copy the data directory from your container to an directory to your host system. The copy command needs tow parameters source and destination. for the source you need to specify the container were you want to grab the files. in our case the container is named pg-dbms. The destination is a PostgreSQL folder in the home directory of the user ed. If you use Windows instead of Linux it works the same. Just adapt the directory path and try to avoid white-spaces. When the files appeared in the defined directory you’re done with this step.

Step 3: stop the current container

docker stop pg-dbms

Bash

In the case you wish to start a container, just replace the word stop for the word start. The container we created to grab the initial files for the PostgreSQL DBMS we don’t need no longer, so we can erase it, but to do that as first the running container have to be stopped.

Step 4: start the current container

docker start pg-dbms

Bash

After the container is stopped we are able to erase it.

Step 5: recreate the container with an external volume

docker run -d --name pg-dbms --restart=no \
--net services --ip 172.18.0.20 \
-e POSTGRES_PASSWORD=s3cr3t \
-e PGPASSWORD=s3cr3t \
-v /media/ed/memory/pg:/var/lib/postgresql/data \
postgres:11

Bash

Now we can link the directory with the exported initial database to a new created PostgreSQL container. that’s all. The big benefit of this activities is, that now every database we create in PostgreSQL and the data of this database is outside of the docker container on our local machine. This allows a much more simpler backup and prevent losing information when a container has to be updated.

If you have instead of PostgreSQL other images where you need to grab files to reuse them you can use this tutorial too. just adapt to the image and the paths you need. The procedure is almost the same. If you like to get to know more facts about Docker you can watch also my video Docker Basics in less then 10 Minutes. In the case you like this short tutorial share it with your friends and colleagues. To stay informed don’t forget to subscribe to my newsletter.

Links sind nur für eingeloggte Nutzer sichtbar.

Docker Basics in less than 10 minutes



This short tutorial covers the most fundamental steps to use docker in your development tool chain. After we introduced the basic theory, we will learn how to install docker on a Linux OS (Ubuntu Mate). When this is done we have a short walk through to download an image and instantiate the container. The example use the official PHP 7.3 image with an Apache 2 HTTP Server.


InPerson (remote) Training’s (Courses) Deutsch / English