AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / coding / 问题

问题[docker-compose](coding)

Martin Hope
Shah-G
Asked: 2024-12-05 12:45:02 +0800 CST

Traefik 幽灵部署端口映射不起作用

  • 5

我使用 Dokploy 部署了一个带有 docker compose 和 traefik(反向代理)的 ghost 博客实例。我在从浏览器访问 ghost 博客部署时遇到问题:出现 Bad Gateway 错误。如果我使用2368ghost 部署的默认端口,则一切正常,但如果我使用端口映射3204:2368在其他端口上访问它,则会收到 Bad Gateway 错误。

docker-compose.yml:

name: ghost-live-1
services:
  ghost:
    image: ghost:5-alpine
    container_name: ghost_serv_live_k
    restart: always
    environment:
      database__client: mysql
      database__connection__host: ghst_db
      database__connection__user: ghost
      database__connection__password: ghost
      database__connection__database: ghost
      url: https://blog.mydomain.com
      NODE_ENV: production
    ports:
      - '3204:2368'
    labels:
      - traefik.docker.network=dokploy-network
      - traefik.enable=true
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-web.rule=Host(`blog.mydomain.com`)
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-web.entrypoints=web
      - traefik.http.services.ghostlive-ghost-2e1bbd-50-web.loadbalancer.server.port=3204
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-web.service=ghostlive-ghost-2e1bbd-50-web
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-web.middlewares=redirect-to-https@file
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-websecure.rule=Host(`blog.mydomain.com`)
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-websecure.entrypoints=websecure
      - traefik.http.services.ghostlive-ghost-2e1bbd-50-websecure.loadbalancer.server.port=3204
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-websecure.service=ghostlive-ghost-2e1bbd-50-websecure
      - traefik.http.routers.ghostlive-ghost-2e1bbd-50-websecure.tls.certresolver=letsencrypt
    volumes:
      - ghost_serv:/var/lib/ghost/content
    depends_on:
      ghst_db:
        condition: service_healthy
    networks:
      - dokploy-network
  ghst_db:
    image: mysql:9
    container_name: ghost_db_live_k
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD=example
      MYSQL_DATABASE=ghost
      MYSQL_USER=ghost
      MYSQL_PASSWORD=ghost
    networks:
      - dokploy-network
    volumes:
      - ghost_db:/var/lib/mysql
    healthcheck:
      test:
        - CMD
        - mysqladmin
        - ping
        - '-h'
        - 127.0.0.1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 60s
volumes:
  ghost_serv:
    driver: local
  ghost_db:
    driver: local
networks:
  dokploy-network:
    external: true

我是否缺少一些关键配置,以致于 ghost 容器无法被 traefik 反向代理访问?

docker-compose
  • 1 个回答
  • 15 Views
Martin Hope
Narayan Agarwal
Asked: 2024-07-03 23:56:41 +0800 CST

docker-compose 转义单引号不起作用

  • 6

docker-compose entrypoint 标签转义单引号不起作用。我尝试使用代码转义 docker-docker entrypoint 标签中的单引号。这在我的命令行中有效,但在 docker-compose entrypoint 中无效...

以下是来自 test.yml 的示例代码:

version: "2.4"
services:
  mysql:
    container_name: test
    image: "java-build:21-focal"
    entrypoint:
      /bin/bash -c "
      echo $'CREATE DATABASE IF NOT EXISTS temporal; CREATE DATABASE IF NOT EXISTS temporal_visibility; GRANT ALL PRIVILEGES ON *.* TO \'temporal_admin\'@\'%\'; GRANT ALL PRIVILEGES ON *.* TO \'temporal_admin\'@\'%\'; FLUSH PRIVILEGES;' > /tmp/init.sql;
      cat /tmp/init.sql
      "

输出:

CREATE DATABASE IF NOT EXISTS temporal; CREATE DATABASE IF NOT EXISTS temporal_visibility; GRANT ALL PRIVILEGES ON *.* TO temporal_admin@%; GRANT ALL PRIVILEGES ON *.* TO temporal_admin@%; FLUSH PRIVILEGES;

正如您所见,转义单引号不起作用...有什么想法吗?

docker-compose
  • 1 个回答
  • 19 Views
Martin Hope
yulia
Asked: 2024-06-10 11:06:42 +0800 CST

Makefile 未将环境变量传递给 docker compose 命令

  • 5

我正在尝试使用 makefile 构建一个 docker 容器:

up_build_dev:
    @echo "Stopping docker images (if running...)"
     docker-compose down
    @echo "Building (when required) and starting docker images..."
     DB_USER=backend DB_PASSWORD=password DB_ROOT_USER=root DB_ROOT_PASSWORD=password DB_NAME=my_db DB_PORT=3306 DB_HOST=mysql LISTEN_PORT=80 HOST_PORT=8080 ENV=dev docker-compose up --build -d
    @echo "Docker images built and started!"

但是,当我在终端中运行此 compose 命令而不使其正常工作时,环境变量未传递。

我尝试使用export和env关键字,但没有效果。

PS:这是一个测试数据库和开发容器,所以我不介意是否暴露任何密码。

docker-compose
  • 1 个回答
  • 19 Views
Martin Hope
Daniel Walker
Asked: 2024-02-14 05:49:18 +0800 CST

不支持的 docker-compose 选项:init

  • 6

我在 Ubuntu 20.04 上运行 docker-compose 1.25.0。我的配置文件看起来像

version: "3"

services:
  foo:
    image: some_image
    init: true
    ...

当我跑步时docker-compose up,我得到

The compose file './docker-compose.yaml' is invalid because:
Unsupported config option for services.foo: 'init'

根据文档,该init选项是在 2.2 版本文件格式中添加的。据此, Compose 版本 1.13.0+ 支持该文件格式。

docker-compose
  • 1 个回答
  • 21 Views
Martin Hope
Ross Dargan
Asked: 2023-11-16 03:55:32 +0800 CST

Docker Stack Deploy 不更新环境设置

  • 5

给定以下撰写文件:

version: '3.6'

services:
  hello-world:
    image: hello-world
    environment:
     - test:test

如果我使用 部署它docker stack deploy -c docker-compose.yml test,则修改 compose 文件如下:

services:
  hello-world:
    image: hello-world
    environment:
     - test:test
     - test2:test2

现在,如果我运行,docker service inspect test_hello-world我会在任务模板中看到以下内容:

"Env": [
    "test:test"
],

我可以使用命令来获取从撰写文件添加的第二个环境变量(test2)吗?

docker-compose
  • 1 个回答
  • 16 Views
Martin Hope
adviner
Asked: 2023-10-03 10:30:36 +0800 CST

MacOS Sonoma 和 Docker 问题

  • 5

我在 MacBook Pro 上更新了 Sonoma。现在,当我尝试进行撰写构建时,出现以下错误:

ERROR [db-crm internal] load metadata for docker.io/library/postgres:15.2 
ERROR [dbpool-crm internal] load metadata for docker.io/brainsam/pgbouncer:latest

failed to solve: postgres:15.2: failed to authorize: failed to fetch oauth token: unexpected status from GET request to https://auth.docker.io/token?scope=repository%3Alibrary%2Fpostgres%3Apull&service=registry.docker.io: 401 Unauthorized

我卸载了 Docker 并重新安装了最新版本的 Apple Silicon 版本的 Docker (4.24.0 (122432)),但问题仍然存在。谷歌了一些,但没有找到解决问题的方法。还有其他人遇到过这个问题吗?

我有一台 2021 年款 Apple M1 Max,配备 32GB 和 2TB 驱动器。

docker-compose
  • 1 个回答
  • 15 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve