{"id":4935,"date":"2026-08-10T22:33:54","date_gmt":"2026-08-10T22:33:54","guid":{"rendered":"https:\/\/netguide.io\/linux\/docker-compose-env-umgebungsvariablen\/"},"modified":"2026-08-10T23:46:34","modified_gmt":"2026-08-10T23:46:34","slug":"docker-compose-env-umgebungsvariablen","status":"publish","type":"post","link":"https:\/\/netguide.io\/linux\/de\/docker-compose-env-umgebungsvariablen\/","title":{"rendered":"Docker Compose: Umgebungsvariablen &#038; .env-Datei nutzen"},"content":{"rendered":"<script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4797\" data-bid=\"2\" data-placement=\"4798\">PGRpdiBpZD0ibmV0Z3VpZGVhLTE4MzUxNzc5NjkiIGNsYXNzPSJuZXRndWlkZWEtYmVmb3JlLWNvbnRlbnQgbmV0Z3VpZGVhLWVudGl0eS1wbGFjZW1lbnQiPjxkaXYgY2xhc3M9Im5ldGd1aWRlYS1hZGxhYmVsIj5BZHZlcnRpc2VtZW50czwvZGl2PjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcz9jbGllbnQ9Y2EtcHViLTYyNTg1NTYyNTcyNDU5OTgiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIiBzdHlsZT0iZGlzcGxheTpibG9jazsiIGRhdGEtYWQtY2xpZW50PSJjYS1wdWItNjI1ODU1NjI1NzI0NTk5OCIgCmRhdGEtYWQtc2xvdD0iMzQ5NDExNTM0MiIgCmRhdGEtYWQtZm9ybWF0PSJhdXRvIj48L2lucz4KPHNjcmlwdD4gCihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7IAo8L3NjcmlwdD4KPC9kaXY+<\/script>\n<p class=\"wp-block-paragraph\">Passw\u00f6rter, Ports und Pfade geh\u00f6ren nicht fest in die <code>docker-compose.yml<\/code> \u2013 sie geh\u00f6ren in Umgebungsvariablen. In dieser Anleitung zeigen wir dir, wie du <strong>Umgebungsvariablen in Docker Compose<\/strong> richtig einsetzt: den Unterschied zwischen <code>environment<\/code>, <code>env_file<\/code> und der <code>.env<\/code>-Datei sowie die praktische Variablen-Substitution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Passw\u00f6rter, API-Schl\u00fcssel und Konfigurationswerte geh\u00f6ren nicht fest in die <code>docker-compose.yml<\/code> \u2013 sie \u00e4ndern sich je nach Umgebung und d\u00fcrfen nicht im Klartext im Repository landen. Genau daf\u00fcr gibt es <strong>Umgebungsvariablen und die .env-Datei<\/strong>. In dieser Anleitung lernst du, wie du Werte sauber aus deinem Compose-Setup auslagerst, zwischen den verschiedenen Mechanismen unterscheidest und sensible Daten vor versehentlicher Ver\u00f6ffentlichung sch\u00fctzt.<\/p>\n\n\n\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-1ffd1ad5      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tInhaltsverzeichnis\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#warum-umgebungsvariablen\" class=\"uagb-toc-link__trigger\">Warum Umgebungsvariablen?<\/a><li class=\"uagb-toc__list\"><a href=\"#variante-1-environment-direkt-im-compose-file\" class=\"uagb-toc-link__trigger\">Variante 1: environment direkt im Compose-File<\/a><li class=\"uagb-toc__list\"><a href=\"#variante-2-auslagern-in-eine-env-file\" class=\"uagb-toc-link__trigger\">Variante 2: Auslagern in eine env_file<\/a><li class=\"uagb-toc__list\"><a href=\"#variante-3-die-env-datei-f\u00fcr-variablen-substitution\" class=\"uagb-toc-link__trigger\">Variante 3: Die .env-Datei f\u00fcr Variablen-Substitution<\/a><li class=\"uagb-toc__list\"><a href=\"#werte-pr\u00fcfen\" class=\"uagb-toc-link__trigger\">Werte pr\u00fcfen<\/a><li class=\"uagb-toc__list\"><a href=\"#secrets-nicht-ins-repository\" class=\"uagb-toc-link__trigger\">Secrets nicht ins Repository<\/a><li class=\"uagb-toc__list\"><a href=\"#env-environment-und-env-file-richtig-unterscheiden\" class=\"uagb-toc-link__trigger\">.env, environment und env_file richtig unterscheiden<\/a><li class=\"uagb-toc__list\"><a href=\"#rangfolge-bei-konflikten\" class=\"uagb-toc-link__trigger\">Rangfolge bei Konflikten<\/a><li class=\"uagb-toc__list\"><a href=\"#sensible-daten-sch\u00fctzen\" class=\"uagb-toc-link__trigger\">Sensible Daten sch\u00fctzen<\/a><li class=\"uagb-toc__list\"><a href=\"#h\u00e4ufige-fragen\" class=\"uagb-toc-link__trigger\">H\u00e4ufige Fragen<\/a><li class=\"uagb-toc__list\"><a href=\"#warum-wird-meine-variable-nicht-ersetzt\" class=\"uagb-toc-link__trigger\">Warum wird meine Variable nicht ersetzt?<\/a><li class=\"uagb-toc__list\"><a href=\"#sind-umgebungsvariablen-sicher-f\u00fcr-passw\u00f6rter\" class=\"uagb-toc-link__trigger\">Sind Umgebungsvariablen sicher f\u00fcr Passw\u00f6rter?<\/a><li class=\"uagb-toc__list\"><a href=\"#kann-ich-mehrere-env-dateien-nutzen\" class=\"uagb-toc-link__trigger\">Kann ich mehrere .env-Dateien nutzen?<\/a><li class=\"uagb-toc__list\"><a href=\"#fazit\" class=\"uagb-toc-link__trigger\">Fazit<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Warum Umgebungsvariablen?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Umgebungsvariablen trennen die <strong>Konfiguration von der Anwendung<\/strong>. Das hat zwei gro\u00dfe Vorteile: Du kannst dieselbe Compose-Datei f\u00fcr Test und Produktion nutzen (nur mit anderen Werten), und du h\u00e4ltst sensible Daten wie Passw\u00f6rter aus der versionierten Datei heraus. Falls du Compose noch einrichten musst, hilft <a href=\"https:\/\/netguide.io\/linux\/de\/docker-compose-installieren-ubuntu-debian\/\">Docker Compose installieren<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Variante 1: environment direkt im Compose-File<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Am direktesten definierst du Variablen im <code>environment<\/code>-Block eines Dienstes. Diese werden <strong>in den Container<\/strong> hineingereicht:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>services:\n  datenbank:\n    image: postgres:16\n    environment:\n      POSTGRES_USER: admin\n      POSTGRES_PASSWORD: geheim\n      POSTGRES_DB: meineapp<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #85E89D\">services<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">  datenbank<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    image<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">postgres:16<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    environment<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">      POSTGRES_USER<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">admin<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">      POSTGRES_PASSWORD<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">geheim<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">      POSTGRES_DB<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">meineapp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Das ist \u00fcbersichtlich, aber Passw\u00f6rter stehen im Klartext in der Datei \u2013 f\u00fcr echte Geheimnisse nicht ideal.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Variante 2: Auslagern in eine env_file<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sauberer ist es, die Variablen in eine eigene Datei auszulagern und per <code>env_file<\/code> einzubinden. Lege z. B. eine Datei <code>db.env<\/code> an:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>POSTGRES_USER=admin\nPOSTGRES_PASSWORD=geheim\nPOSTGRES_DB=meineapp<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">POSTGRES_USER<\/span><span style=\"color: #E1E4E8\">=admin<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">POSTGRES_PASSWORD<\/span><span style=\"color: #E1E4E8\">=geheim<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">POSTGRES_DB<\/span><span style=\"color: #E1E4E8\">=meineapp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Und binde sie im Dienst ein:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>services:\n  datenbank:\n    image: postgres:16\n    env_file:\n      - db.env<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #85E89D\">services<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">  datenbank<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    image<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">postgres:16<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    env_file<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      - <\/span><span style=\"color: #9ECBFF\">db.env<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Die Werte aus <code>db.env<\/code> landen als Umgebungsvariablen im Container. Diese Datei nimmst du dann von der Versionsverwaltung aus (siehe unten).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Variante 3: Die .env-Datei f\u00fcr Variablen-Substitution<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Hier lauert die h\u00e4ufigste Verwechslung. Die speziell benannte Datei <code>.env<\/code> im Projektverzeichnis wird von Compose automatisch geladen \u2013 aber f\u00fcr einen <strong>anderen Zweck<\/strong>: Ihre Werte ersetzen Platzhalter <strong>innerhalb der Compose-Datei selbst<\/strong>. Lege eine <code>.env<\/code> an:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>NGINX_PORT=8080\nPOSTGRES_VERSION=16<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">NGINX_PORT<\/span><span style=\"color: #E1E4E8\">=8080<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">POSTGRES_VERSION<\/span><span style=\"color: #E1E4E8\">=16<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Und referenziere die Werte in der <code>docker-compose.yml<\/code> mit <code>${...}<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>services:\n  web:\n    image: nginx:latest\n    ports:\n      - \"${NGINX_PORT}:80\"\n  datenbank:\n    image: postgres:${POSTGRES_VERSION}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #85E89D\">services<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">  web<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    image<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">nginx:latest<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    ports<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">      - <\/span><span style=\"color: #9ECBFF\">\"${NGINX_PORT}:80\"<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">  datenbank<\/span><span style=\"color: #E1E4E8\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #85E89D\">    image<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #9ECBFF\">postgres:${POSTGRES_VERSION}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">So passt du Ports oder Versionen zentral an einer Stelle an. Der Unterschied in einem Satz: <strong><code>.env<\/code> ersetzt Platzhalter in der Compose-Datei, <code>env_file<\/code> setzt Variablen im Container.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Werte pr\u00fcfen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ob die Substitution wie erwartet greift, siehst du, ohne etwas zu starten. Der folgende Befehl zeigt die fertig aufgel\u00f6ste Konfiguration:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>docker compose config<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">docker<\/span><span style=\"color: #9ECBFF\"> compose<\/span><span style=\"color: #9ECBFF\"> config<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Secrets nicht ins Repository<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ganz wichtig: Dateien mit Passw\u00f6rtern geh\u00f6ren nicht in ein \u00f6ffentliches Git-Repository. Trage sie in die <code>.gitignore<\/code> ein:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>.env\n*.env<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">.env<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">*.env<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">F\u00fcr h\u00f6here Sicherheitsanforderungen bietet Docker zus\u00e4tzlich das Konzept der <em>Secrets<\/em>, bei dem Geheimnisse als Dateien statt als Umgebungsvariablen bereitgestellt werden \u2013 ein sinnvoller n\u00e4chster Schritt f\u00fcr produktive Setups.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">.env, environment und env_file richtig unterscheiden<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Docker Compose kennt mehrere Wege, Variablen zu setzen \u2013 und sie werden leicht verwechselt. Die <code>.env<\/code>-Datei f\u00fcllt Platzhalter <strong>innerhalb<\/strong> der Compose-Datei, w\u00e4hrend <code>environment<\/code> und <code>env_file<\/code> Variablen <strong>in den Container<\/strong> hineinreichen. Dieser Unterschied ist die h\u00e4ufigste Fehlerquelle.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Mechanismus<\/th><th>Wirkung<\/th><th>Sichtbar in<\/th><\/tr><\/thead><tbody><tr><td><code>.env<\/code> (Projektwurzel)<\/td><td>Ersetzt <code>${VAR}<\/code> in der Compose-Datei<\/td><td>Compose-Parsing<\/td><\/tr><tr><td><code>environment:<\/code><\/td><td>Setzt Variablen im Container<\/td><td>Der Anwendung<\/td><\/tr><tr><td><code>env_file:<\/code><\/td><td>L\u00e4dt eine Datei mit Variablen in den Container<\/td><td>Der Anwendung<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Rangfolge bei Konflikten<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Wird dieselbe Variable an mehreren Stellen gesetzt, gewinnt die spezifischere Quelle. Diese Reihenfolge zu kennen erspart dir stundenlange Fehlersuche, wenn ein Wert scheinbar ignoriert wird.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ein Wert direkt unter <code>environment:<\/code> hat Vorrang vor <code>env_file:<\/code>.<\/li>\n\n<li>Auf der Shell gesetzte Variablen \u00fcberschreiben die <code>.env<\/code>-Datei beim Parsen.<\/li>\n\n<li>Fehlt ein Platzhalter ganz, setzt Compose ihn auf einen leeren String \u2013 oft die Ursache stiller Fehler.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Sensible Daten sch\u00fctzen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Eine <code>.env<\/code>-Datei mit echten Passw\u00f6rtern hat in keinem Git-Repository etwas verloren. Trage sie deshalb sofort in deine <code>.gitignore<\/code> ein und gib stattdessen eine <code>.env.example<\/code> mit leeren Platzhaltern weiter. So wissen andere, welche Werte n\u00f6tig sind, ohne dass Geheimnisse durchsickern.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">F\u00fcr h\u00f6here Sicherheitsanforderungen bietet Docker au\u00dferdem <strong>Secrets<\/strong>. Anders als Umgebungsvariablen werden sie nicht in der Prozessliste oder in <code>docker inspect<\/code> sichtbar, sondern als Datei in den Container gemountet \u2013 die sauberere L\u00f6sung f\u00fcr produktive Zugangsdaten. Der Aufwand lohnt sich vor allem dort, wo mehrere Personen Zugriff auf den Host haben, denn Umgebungsvariablen lassen sich von jedem auslesen, der Container inspizieren darf.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ein oft \u00fcbersehenes Detail ist die Typisierung: In der <code>.env<\/code>-Datei ist alles ein String. Werte wie <code>true<\/code> oder Zahlen werden also als Text \u00fcbergeben, was manche Anwendungen anders interpretieren, als du erwartest. Setze Werte mit Sonderzeichen oder Leerzeichen sicherheitshalber in Anf\u00fchrungszeichen und vermeide Leerzeichen um das Gleichheitszeichen, da Compose die Zeile sonst nicht sauber parst. Wer diese kleinen Regeln kennt, spart sich viele schwer auffindbare Konfigurationsfehler.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">H\u00e4ufige Fragen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Die h\u00e4ufigsten Fragen zu Umgebungsvariablen in Docker Compose.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Warum wird meine Variable nicht ersetzt?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Meist liegt die <code>.env<\/code>-Datei nicht im selben Verzeichnis wie die Compose-Datei oder der Platzhalter ist falsch geschrieben. Compose sucht die <code>.env<\/code> standardm\u00e4\u00dfig neben der <code>docker-compose.yml<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sind Umgebungsvariablen sicher f\u00fcr Passw\u00f6rter?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Nur bedingt. Sie tauchen in <code>docker inspect<\/code> und teils in Logs auf. F\u00fcr echte Geheimnisse solltest du Docker Secrets oder ein externes Vault-System verwenden.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Kann ich mehrere .env-Dateien nutzen?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ja, \u00fcber die Option <code>--env-file<\/code> beim <code>docker compose<\/code>-Aufruf l\u00e4dst du gezielt eine bestimmte Datei, etwa f\u00fcr Staging und Produktion getrennt.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Fazit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Mit Umgebungsvariablen machst du deine Compose-Setups flexibel und sicherer. Merke dir die drei Werkzeuge: <code>environment<\/code> f\u00fcr einzelne Werte, <code>env_file<\/code> zum Auslagern in den Container und die <code>.env<\/code>-Datei f\u00fcr die Substitution in der Compose-Datei. Halte Geheimnisse per <code>.gitignore<\/code> aus dem Repository heraus. Passend weiter geht es mit <a href=\"https:\/\/netguide.io\/linux\/de\/docker-volumes-daten-persistent-speichern\/\">Docker Volumes<\/a> und <a href=\"https:\/\/netguide.io\/linux\/de\/docker-restart-policy-container-automatisch-starten\/\">Restart-Policies<\/a>.<\/p>\n<script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4799\" data-bid=\"2\" data-placement=\"4800\">PGRpdiBpZD0ibmV0Z3VpZGVhLTIyODM3MTI2OTQiIGNsYXNzPSJuZXRndWlkZWEtYWZ0ZXItY29udGVudCBuZXRndWlkZWEtZW50aXR5LXBsYWNlbWVudCI+PGRpdiBjbGFzcz0ibmV0Z3VpZGVhLWFkbGFiZWwiPkFkdmVydGlzZW1lbnRzPC9kaXY+PHNjcmlwdCBhc3luYyBzcmM9Ii8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2pzL2Fkc2J5Z29vZ2xlLmpzP2NsaWVudD1jYS1wdWItNjI1ODU1NjI1NzI0NTk5OCIgY3Jvc3NvcmlnaW49ImFub255bW91cyI+PC9zY3JpcHQ+PGlucyBjbGFzcz0iYWRzYnlnb29nbGUiIHN0eWxlPSJkaXNwbGF5OmJsb2NrOyIgZGF0YS1hZC1jbGllbnQ9ImNhLXB1Yi02MjU4NTU2MjU3MjQ1OTk4IiAKZGF0YS1hZC1zbG90PSI0NTU5Nzg1MDAyIiAKZGF0YS1hZC1mb3JtYXQ9ImF1dG8iPjwvaW5zPgo8c2NyaXB0PiAKKGFkc2J5Z29vZ2xlID0gd2luZG93LmFkc2J5Z29vZ2xlIHx8IFtdKS5wdXNoKHt9KTsgCjwvc2NyaXB0Pgo8L2Rpdj4=<\/script>","protected":false},"excerpt":{"rendered":"<p>Umgebungsvariablen in Docker Compose richtig nutzen: environment, env_file und die .env-Datei erkl\u00e4rt \u2013 inklusive Variablen-Substitution und Tipps zu Secrets.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[231,9],"tags":[],"class_list":["post-4935","post","type-post","status-publish","format-standard","hentry","category-docker","category-linux"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Tobias Pries","author_link":"https:\/\/netguide.io\/linux\/author\/tobias-pries\/"},"uagb_comment_info":0,"uagb_excerpt":"Umgebungsvariablen in Docker Compose richtig nutzen: environment, env_file und die .env-Datei erkl\u00e4rt \u2013 inklusive Variablen-Substitution und Tipps zu Secrets.","brizy_media":[],"_links":{"self":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/4935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/comments?post=4935"}],"version-history":[{"count":2,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/4935\/revisions"}],"predecessor-version":[{"id":4996,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/4935\/revisions\/4996"}],"wp:attachment":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media?parent=4935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/categories?post=4935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/tags?post=4935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}