Top Menu

Jump to content
Home
    • Projects
    • Work packages
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Create a new account
      Forgot your password?

Side Menu

  • Overview
  • Activity
  • Wiki
    • Table of contents
      • Expanded. Click to collapseCollapsed. Click to showWiki
        • Hierarchy leafModalität
        • Expanded. Click to collapseCollapsed. Click to showThemen
          • Hierarchy leaf00) Installation GNU/Linux in Virtualbox
          • Hierarchy leaf01) GNU/Linux Basics & Bash commandos
          • Hierarchy leaf02) Schulinternes APT Repository
          • Hierarchy leaf03) Fernwartung über SSH
          • Hierarchy leaf04) Prozesse und Systemd
          • Hierarchy leaf05) UFW
          • Hierarchy leaf06) MySQL
          • Hierarchy leaf07) Abfragen an die Mondial Datenbank
          • Hierarchy leaf08) PostgreSQL
          • Hierarchy leaf10) Crontab
          • Hierarchy leaf11) Wordpress
          • Expanded. Click to collapseCollapsed. Click to show12) Docker
            • Hierarchy leaf00) MySQL - Volumes - Ports ...
            • Hierarchy leaf01) PostgreSQL
            • Hierarchy leaf02) Docker-Compose
You are here:
  • Wiki
  • Themen
  • 12) Docker
  • 02) Docker-Compose

Content

02) Docker-Compose

  • More
    • Print
    • Table of contents

Docker-compose bietet die Möglichkeit Container zu orchestrieren. In Einem File werden mehrere Services kombiniert.

Als Beispiel könnte eine Wordpress installation dienen:

  • Webserver
  • Datenbankserver

Als Beispiel hier, soll der selbstgemachte MySQL Container dienen.

Docker compose installieren:

sudo apt-get install docker-compose

Compose file für Mysql:

version: "3"
services:
        mysql:
                network_mode: bridge
                restart: always
                container_name: mysqlcontainer
                build:
                        context: .
                        dockerfile: Mysqldocker
                volumes:
                        - mysqlvolume:/var/lib/mysql
                ports:
                        - 12345:3306
                        
volumes:
        mysqlvolume:

Container mit compose file starten

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

Container mit compose file stoppen

docker-compose -f mysql-compose.yml stop

User erstellen/daten einfügen/verbinden

echo "CREATE user 'mondial'@'%' IDENTIFIED BY 'pwd';" | docker exec -i mysqlcontainer mysql
echo "CREATE DATABASE Mondial" | docker exec -i mysqlcontainer mysql
echo "GRANT ALL PRIVILEGES ON Mondial.* to 'mondial'@'%'" | docker exec -i mysqlcontainer mysql

wget https://www.dbis.informatik.uni-goettingen.de/Mondial/OtherDBMSs/mondial-schema-mysql.sql
wget https://www.dbis.informatik.uni-goettingen.de/Mondial/OtherDBMSs/mondial-inputs-mysql.sql
cat mondial-schema-mysql.sql | mysql --host=127.0.0.1 --port=12345 -u mondial -p
cat mondial-inputs-mysql.sql | mysql --host=127.0.0.1 --port=12345 -u mondial -p
mysql --host=127.0.0.1 --port=12345 -u mondial -p
use Mondial;
select name from country where name like 'A%';
Loading...