Docker Quick Start: Why? What are containers for? Hardware?

 

What are Docker containers?

Docker containers are small isolated program units that can be started independently of the operating system on almost any PC or server. The user interface of a container is usually provided in the form of a web service and can thus be accessed via an address in the browser. Calling from a PC, smartphone or tablet is done via any browser and therefore does not require any additional installed software or app.

How can a Docker container be started?

To start a container, it is sufficient to specify an image in the form of manufacturer/imagename. This is made possible by the Docker Registry, a kind of library for containers. After installation, Docker is connected to the official online Docker Registry: Docker Hub, which means that specifying the imagename is enough to download and launch the container: no matter what hardware, no matter what operating system, and no matter what other programs have already been installed on the system: Due to the encapsulation, the containers are isolated and independent and contain all the dependencies necessary for operation.

Command for starting a container

In detail, the startup process of a container in the terminal looks like this:

docker run docker/getting-started

The "docker run" command downloads the "getting-started" container from the "docker" vendor and starts it:

C:\Users\LiBe>docker run -p 8080:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
...
2023/05/28 18:30:23 [notice] 1#1: start worker processes

The parameter -p 8080:80 publishes port 80 and makes it available through localhost and port 8080:

How to access the user interface of a container?

A Docker service is usually accessed via a provided web service. Typically, the web server provided by a container can be accessed via the browser with localhost and a port specified when starting the container: as an example: http://localhost:8080.

Prerequisite: almost any PC or server, operating system and the Docker installation.

Any computer or mini-PC with x68-64 architecture can be used as hardware for starting the containers, see: Home Server. Depending on which operating system is used, the actual Docker installation differs:

Docker containers require a Linux kernel, so container scan likely be run with a Linux distribution - unlike Windows - with less overhead.

Multiple containers for a given service -> Docker Compose.

Docker containers provide network services, as an example a web server or database. Certain web applications require multiple containers to run. The launch of multiple containers and their access to and among each other can be specified using Docker Compose and a simple test file: docker-compose.yml.

The previously mentioned container: "getting-started" can be defined using a docker-compose.yml file as follows:

Text file named "docker-compose.yml".

Content:

services:
  app:
    image: docker/getting-started
    ports:
      - 8080:80

If a text file is populated with this content, all services mentioned in the file can be started from its folder with one command: "docker-compose up"

root@server:~/# docker-compose up
Creating network "test_default" with the default driver
Creating test_app_1 ... done
Attaching to test_app_1

To start more services from the text file, they can be added as additional services:

services:
  app:
    image: docker/getting-started
    ports:
      - 8080:80
  app2:
    image: docker/getting-started
    ports:
      - 8081:80

Step by step guide published as YouTube video

Docker-Webservices, examples

Here is a list of web services I have tested so far:

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Updated: 2023-09-06 von Bernhard | Übersetzung Deutsch |🔔 | Comments:0

Docker | Launch Docker containers on Linux.

Top articles in this section


Traefik: Forward traffic to another server

In preparation for moving my websites, I was looking for a way to simply forward all traffic from the old server to the new one.


Docker Swarm, Portainer and Traefik combined

As mentioned several times on this page, I primarily use the reverse proxy Traefik to access my Docker containers. To be able to manage the containers in a graphical GUI, I also use Portainer. For a single server, the setup fits so far, but if you want to deploy multiple servers, you can use Docker-Swarm for that. I first tested Portainer in combination with Swarm and extended the setup with Traefik including SSL with Let's Encrypt.


Practice: Backup Docker container data: Volumes / Bind Mounts

In my article "All Docker containers: Moving hosts, theory and practice", I already went a little bit into the topic of backup. If you followed the article, you know that I outsource the data of my Docker containers via bind mounts and back them up with rsync. The backup job is started via crontab. But first, I thought about what actually needs to be backed up when using Docker in a single-server setup.

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details