So verwenden Sie MySQL mit Docker und Docker-Compose

In diesem Tutorial erklären wir Schritt für Schritt, wie Sie MySQL mit Docker und docker-compose verwenden, damit die Dinge leicht verständlich bleiben. 

Führen Sie MySQL mit Docker aus

Für diesen Anfängerleitfaden verwenden wir das offizielle MySQL-Docker-Image von DockerHub. Das offizielle MySQL-Docker-Image hat keine Alpine-Linux-Version, die Debian-Version ist jedoch ebenfalls 147 MB ​​groß, was für ein Docker-Image nicht zu groß ist.

Um den MySQL 8.0-Container mit dem offiziellen Image auszuführen, führen Sie einfach den folgenden Befehl aus:

mkdir /tmp/mysql-data
docker run --name basic-mysql --rm -v /tmp/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=ANSKk08aPEDbFjDO -e MYSQL_DATABASE=testing -p 3306:3306 -it mysql:8.0

Analysieren wir den Befehl, den wir gerade ausgeführt haben, um MySQL mit Docker auszuführen. Zuerst haben wir ein Verzeichnis erstellt, das aufgerufen wird , um die Daten von MySQL zu speichern mysql-data. /tmpDann haben wir einen docker runBefehl ausgeführt mit:

  • --nameum den Behälter zu benennenbasic-mysql
  • --rnum den Container zu entfernen, wenn er gestoppt ist
  • -v /tmp/mysql-data:/var/lib/mysqlhinzugefügt wird, um die Daten beizubehalten, wenn der Container neu gestartet wird, verschwindet sie, wenn der Hostcomputer so neu gestartet wird, wie sie sich befindet/tmp
  • -e MYSQL_ROOT_PASSWORD=ANSKk08aPEDbFjDO -e MYSQL_DATABASE=testingzum Festlegen des Passworts des Root-Benutzers und zum Initialisieren einer Datenbank mit dem Namentesting
  • -p 3306:3306ordnet den Host-Port 3306 dem Container-Port 3306 zu, wobei Port 3306 der Standard-Port von MySQL ist.
  • -it mysql:8.0- -es werden alle Protokolle angezeigt und wir verwenden die offizielle MySQL-Image-Version 8.0, auf der die Debian-Variante ausgeführt wird.

Es wird ähnlich wie unten angezeigt und ausgegeben:

2022-02-19 10:31:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
2022-02-19 10:31:54+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-02-19 10:31:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
2022-02-19 10:31:54+00:00 [Note] [Entrypoint]: Initializing database files
2022-02-19T10:31:54.932929Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.27) initializing of server in progress as process 44
2022-02-19T10:31:54.942400Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2022-02-19T10:31:54.952407Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-02-19T10:31:57.114688Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-02-19T10:31:58.994205Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-02-19T10:31:58.994241Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-02-19T10:31:59.204723Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-02-19 10:32:03+00:00 [Note] [Entrypoint]: Database files initialized
2022-02-19 10:32:03+00:00 [Note] [Entrypoint]: Starting temporary server
mysqld will log errors to /var/lib/mysql/568272f57c6b.err
mysqld is running as pid 95
2022-02-19 10:32:04+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2022-02-19 10:32:08+00:00 [Note] [Entrypoint]: Creating database testing

2022-02-19 10:32:08+00:00 [Note] [Entrypoint]: Stopping temporary server
2022-02-19 10:32:10+00:00 [Note] [Entrypoint]: Temporary server stopped

2022-02-19 10:32:10+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2022-02-19T10:32:10.353185Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1
2022-02-19T10:32:10.361054Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2022-02-19T10:32:10.379917Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-02-19T10:32:11.007492Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-02-19T10:32:11.362057Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-02-19T10:32:11.362123Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-02-19T10:32:11.366535Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-02-19T10:32:11.366644Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-02-19T10:32:11.372769Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2022-02-19T10:32:11.435797Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-02-19T10:32:11.435995Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

Während der MySQL-Server läuft, können wir den MySQL-Befehl innerhalb des Containers ausführen mit:

docker exec -it basic-mysql /bin/bash
#once inside the container 
mysql -uroot -p
#put/paste the password, and once inside MySQL CLI run
show databases;

Es wird wie folgt aussehen:

Verwenden Sie MySQL mit Docker, das in den Container geht

Wir können den Container mit stoppen docker stop basic-mysql.

Obwohl das nicht allzu schwer war, würde ich es nicht als einfach betrachten, da die Parameter des Befehls nicht einfach zu merken waren. Ein weiterer Aspekt ist, dass wir MySQL isoliert ausgeführt haben, es gibt keine Verbindung zwischen der Node.js-Anwendung der Quotes-API und dem MySQL-Container. Hier erweist sich die deklarative Natur von docker-compose als sehr praktisch, wie wir im nächsten Abschnitt sehen werden.

Ausführen von MySQL mit docker-compose

Um dasselbe MySQL 8.0 mit docker-compose auszuführen, erstellen wir eine neue docker-compose-mysql-only.yml-Datei mit folgendem Inhalt:

version: '3.8'
services:
  db:
    image: mysql:8.0
    cap_add:
      - SYS_NICE
    restart: always
    environment:
      - MYSQL_DATABASE=quotes
      - MYSQL_ROOT_PASSWORD=mauFJcuf5dhRMQrjj
    ports:
      - '3306:3306'
    volumes:
      - db:/var/lib/mysql
      - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
  db:
    driver: local

Die obige Docker-Compose-Datei hat die folgenden Dinge zu verstehen:

  1. Es verwendet die Docker-Compose-Dateiversion 3.8 , eine der neuesten.
  2. Folglich definieren wir dbeinen Dienst, jeder Dienst entspricht einem neuen Docker-Ausführungsbefehl
  3. Anschließend weisen wir docker-compose darauf hin, das offizielle MySQL 8.0-Image für diesen DB-Dienst zu verwenden.
  4. Das cap_addSet to SYS_NICE unterdrückt einige nicht sinnvolle Fehlermeldungen.
  5. Als nächstes bitten wir docker-compose, diesen Container immer neu zu starten, wenn er fehlschlägt.
  6. Danach fügen wir 2 Umgebungsvariablen für die MySQL-Datenbank und das Passwort des Root-Benutzers hinzu. Bei Bedarf können wir einen weiteren Benutzer hinzufügen, um ihm weniger Privilegien mit anderen env-Variablen zu geben.
  7. Dann ordnen wir den Host-Port 3306dem Container-Port zu, 3306da der MySQL-Server auf dem Container-Port läuft 3306. Je nach Präferenz kann der Host-Port geändert werden.
  8. Dann fügen wir 2 Volumes hinzu, das erste ist das DB-Volume, das den folgenden Volumes zugeordnet ist db. Was Docker und Docker-Compose im Grunde anweist, das Volumen für uns zu verwalten. Als nächstes fügen wir ein init.sqlSkript hinzu, das unsere Datenbank mit der angegebenen SQL-Datei initialisiert .quotes

Wir können den MySQL-Container diesmal mit docker-compose starten mit:

docker-compose -f docker-compose-mysql-only.yml up

Es wird eine Ausgabe wie unten angezeigt:

Starting nodejs-mysql_db_1 ... done
Attaching to nodejs-mysql_db_1
db_1  | 2022-02-19 10:55:55+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
db_1  | 2022-02-19 10:55:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1  | 2022-02-19 10:55:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
db_1  | 2022-02-19T10:55:56.381394Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1
db_1  | 2022-02-19T10:55:56.392419Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1  | 2022-02-19T10:55:56.878693Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1  | 2022-02-19T10:55:57.258522Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
db_1  | 2022-02-19T10:55:57.268530Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1  | 2022-02-19T10:55:57.305749Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
db_1  | 2022-02-19T10:55:57.305945Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
db_1  | 2022-02-19T10:55:57.309232Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1  | 2022-02-19T10:55:57.309330Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1  | 2022-02-19T10:55:57.313177Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1  | 2022-02-19T10:55:57.374334Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1  | 2022-02-19T10:55:57.374405Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

Die Ausgabe ist ähnlich, aber dieses Mal mit Docker-Compose deklarativ, war das Ausführen von MySQL in einem Docker-Container ein viel einfacherer Befehl.
Als Referenz ist auch der PR zum Hinzufügen dieser Datei verfügbar. Als nächstes werden wir den MySQL-Container mit unserer bestehenden Node.js-App verknüpfen.

Hinzufügen von MySQL zu einer bestehenden Node.js-App mit docker-compose

An diesem Punkt haben wir MySQL nur mit Docker und dann mit Docker-Compose ausgeführt, was viel einfacher war als der vorherige lange Befehl. Noch fehlt ein Puzzleteil, nämlich die Verknüpfung des MySQL-Containers mit einer Anwendung. In unserem Fall handelt es sich um die Node.js-MySQL-API für Angebote.

Für dieses Anfänger-Tutorial werden wir ein neues docker-compose filemit den folgenden Inhalten hinzufügen:

version: '3.8'
services:
  db:
    image: mysql:8.0
    cap_add:
      - SYS_NICE
    restart: always
    environment:
      - MYSQL_DATABASE=quotes
      - MYSQL_ROOT_PASSWORD=mauFJcuf5dhRMQrjj
    ports:
      - '3306:3306'
    volumes:
      - db:/var/lib/mysql
      - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
  api:
    container_name: quotes-api
    build:
      context: ./
      target: production
    image: quotes-api
    depends_on:
      - db
    ports:
      - 3000:3000
    environment:
      NODE_ENV: production
      DB_HOST: db
      DB_PORT: 3306
      DB_USER: root
      DB_PASSWORD: mauFJcuf5dhRMQrjj
      DB_NAME: quotes
    links:
      - db
    volumes:
      - ./:/src
volumes:
  db:
    driver: local

Diese docker-compose.yml-Datei sieht aus wie eine längere Version der obigen Datei. Die Hauptunterschiede umfassen:

Hinzufügen des API-Dienstes, der Dockerfiledie im Projekt enthaltene verwendet. APIWir werden den Service mit der Zielproduktion aufbauen . Je nach Interesse können Sie mehr über mehrstufige Docker-Builds lesen, in denen die Verwendung des Build-Ziels erläutert wird.

Als nächstes geben wir docker-compose an, dass die API vom DB-Container abhängt. Danach ordnen wir den Host-Port 3000dem Container-Port zu, 3000da die Express.js-App mit Node.js auf Port läuft 3000.

Anschließend setzen wir alle benötigten Umgebungsvariablen so, dass sich die Node.js-App problemlos mit der im Container laufenden MySQL-Datenbank verbindet. Danach ordnen wir die lokale Datei ./dem ./srcContainer zu, sodass alle Dateiänderungen im Container widergespiegelt werden. Als nächstes verknüpfen wir beide Container, damit der API-Container mit dem DB-Container kommunizieren kann.

Diese docker-compose.ymlDatei ist als Pull-Request als Referenz verfügbar.

Wenn wir die Anwendung mit ausführen docker-compose up, sehen wir eine Ausgabe wie die folgende:

Starting nodejs-mysql_db_1 ... done
Starting quotes-api        ... done
Attaching to nodejs-mysql_db_1, quotes-api
db_1   | 2022-02-19 11:08:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
db_1   | 2022-02-19 11:08:36+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1   | 2022-02-19 11:08:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
db_1   | 2022-02-19T11:08:36.469670Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1
db_1   | 2022-02-19T11:08:36.478201Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1   | 2022-02-19T11:08:36.830802Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1   | 2022-02-19T11:08:37.004513Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
db_1   | 2022-02-19T11:08:37.015831Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
db_1   | 2022-02-19T11:08:37.063455Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
db_1   | 2022-02-19T11:08:37.063521Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
db_1   | 2022-02-19T11:08:37.064770Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1   | 2022-02-19T11:08:37.064845Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1   | 2022-02-19T11:08:37.068935Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1   | 2022-02-19T11:08:37.109788Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1   | 2022-02-19T11:08:37.109836Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
quotes-api | 
quotes-api | > nodejs-mysql@0.0.0 start /src
quotes-api | > node ./bin/www
quotes-api | 

Wenn wir den Browser mit http://localhost:3000/quotesdrücken, können wir so etwas wie das Folgende sehen:

Verwenden Sie MySQL mit Docker mit einer vorhandenen Node.js-Anwendung

Toll! Unsere Node.js Express Quotes API kommuniziert ordnungsgemäß mit dem lokalen MySQL, das im Docker-Container ausgeführt wird und mit docker-compose verbunden ist. Da die Daten aus dem init.sqlSkript eingefügt wurden, sind die Zitate in der API-Antwort verfügbar.

In diesem Leitfaden haben wir gesehen, wie man MySQL mit docker run, dann docker-compose und schließlich Schritt für Schritt mit einer Node.js-Anwendung verknüpft.

What is GEEK

Buddha Community

Joe  Hoppe

Joe Hoppe

1595905879

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

HTML to Markdown

MySQL is the all-time number one open source database in the world, and a staple in RDBMS space. DigitalOcean is quickly building its reputation as the developers cloud by providing an affordable, flexible and easy to use cloud platform for developers to work with. MySQL on DigitalOcean is a natural fit, but what’s the best way to deploy your cloud database? In this post, we are going to compare the top two providers, DigitalOcean Managed Databases for MySQL vs. ScaleGrid MySQL hosting on DigitalOcean.

At a glance – TLDR
ScaleGrid Blog - At a glance overview - 1st pointCompare Throughput
ScaleGrid averages almost 40% higher throughput over DigitalOcean for MySQL, with up to 46% higher throughput in write-intensive workloads. Read now

ScaleGrid Blog - At a glance overview - 2nd pointCompare Latency
On average, ScaleGrid achieves almost 30% lower latency over DigitalOcean for the same deployment configurations. Read now

ScaleGrid Blog - At a glance overview - 3rd pointCompare Pricing
ScaleGrid provides 30% more storage on average vs. DigitalOcean for MySQL at the same affordable price. Read now

MySQL DigitalOcean Performance Benchmark
In this benchmark, we compare equivalent plan sizes between ScaleGrid MySQL on DigitalOcean and DigitalOcean Managed Databases for MySQL. We are going to use a common, popular plan size using the below configurations for this performance benchmark:

Comparison Overview
ScaleGridDigitalOceanInstance TypeMedium: 4 vCPUsMedium: 4 vCPUsMySQL Version8.0.208.0.20RAM8GB8GBSSD140GB115GBDeployment TypeStandaloneStandaloneRegionSF03SF03SupportIncludedBusiness-level support included with account sizes over $500/monthMonthly Price$120$120

As you can see above, ScaleGrid and DigitalOcean offer the same plan configurations across this plan size, apart from SSD where ScaleGrid provides over 20% more storage for the same price.

To ensure the most accurate results in our performance tests, we run the benchmark four times for each comparison to find the average performance across throughput and latency over read-intensive workloads, balanced workloads, and write-intensive workloads.

Throughput
In this benchmark, we measure MySQL throughput in terms of queries per second (QPS) to measure our query efficiency. To quickly summarize the results, we display read-intensive, write-intensive and balanced workload averages below for 150 threads for ScaleGrid vs. DigitalOcean MySQL:

ScaleGrid MySQL vs DigitalOcean Managed Databases - Throughput Performance Graph

For the common 150 thread comparison, ScaleGrid averages almost 40% higher throughput over DigitalOcean for MySQL, with up to 46% higher throughput in write-intensive workloads.

#cloud #database #developer #digital ocean #mysql #performance #scalegrid #95th percentile latency #balanced workloads #developers cloud #digitalocean droplet #digitalocean managed databases #digitalocean performance #digitalocean pricing #higher throughput #latency benchmark #lower latency #mysql benchmark setup #mysql client threads #mysql configuration #mysql digitalocean #mysql latency #mysql on digitalocean #mysql throughput #performance benchmark #queries per second #read-intensive #scalegrid mysql #scalegrid vs. digitalocean #throughput benchmark #write-intensive

Docker Compose: How to Install WordPress on Docker using MySQL Backend

We can create a container and run it using Dockerfile. We can even run multiple container in separate ports using two Dockefiles in multiple terminals.

But when you want to create more than one container for your application, you have to create several Docker files. This adds on the load of maintaining them and is also quite time-consuming.

This blog is continuation with my previous blogwhere i showed** How to Install WordPress on Docker using MySQL Backend**

This problem is solved by **Docker Compose. **Docker compose is a tool which is used for multi-container applications in a single host.

For example in my previous blog I have to run two container : first wordpress container and second mysql container as backend.

We can run multi containers as services in the single host with the help of docker-compose.yaml.

Docker Swarm extends the concept of manage multiple containers deployed across multiple node docker cluster.

Installation

  1. Run this command to download the current stable release of Docker Compose in linux :
curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#docker-compose #containers #docker #mysql #wordpress

Deploy and Run Spring boot with MySQL Application in Docker and Docker Compose

In this video you will learn how to Dockerize spring boot with MySQL application and Dockerize a Spring Boot with MySQL using docker-compose in Ubuntu machine.

Git Hub Link: https://github.com/shameed1910/springboot-mysql-docker.git
Previous video link: https://youtu.be/EZolJ4lNiYc

#mysql #docker #docker compose #spring boot

Marcelle  Kunde

Marcelle Kunde

1594292220

Docker-compose for MySQL with phpMyAdmin

Docker-compose is an useful utility for managing multi-container docker applications. In our previous tutorial, I had discussed about the keep persistent data of MySQL docker containers using Docker volumes. Once you launched a MySQL container can be connect via terminal directly. But the phpMyAdmin lovers may need the web interface for managing databases.

In this tutorial, you will learn to launch MySQL Docker containers along with phpMyAdmin docker container using docker-compose command.

Prerequisites

This guide assumes that you have already done the followings:

  1. You have installed Docker service on your System
  2. Also, have configured docker-compose utility on your system

How to Create MySQL with phpMyAdmin Docker Container

phpMyAdmin is an most popular web application for managing MySQL database servers. In this tutorial, we just use an example of Docker container for MySQL and phpMyAdmin.

So first create a docker-compose.yml file on your system with the following content.

docker-compose.yml:

version: '3'

services:
  db:
    image: mysql:5.7
    container_name: db
    environment:
      MYSQL_ROOT_PASSWORD: my_secret_password
      MYSQL_DATABASE: app_db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_user_pass
    ports:
      - "6033:3306"
    volumes:
      - dbdata:/var/lib/mysql
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: pma
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    restart: always
    ports:
      - 8081:80
volumes:
  dbdata:

Save you file and close it.

#general articles #docker #docker-compose #mysql #phpmyadmin

Iliana  Welch

Iliana Welch

1595249460

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub

In this video lesson you will learn:

  • What is Docker Host
  • What is Docker Engine
  • Learn about Docker Architecture
  • Learn about Docker client and Docker Daemon
  • Docker Hub and Registries
  • Simple demo to understand using images from registries

#docker #docker hub #docker host #docker engine #docker architecture #api