【发布时间】:2020-09-03 17:21:28
【问题描述】:
我有一个运行 Couchbase 的 docker 容器,我需要对其执行一个操作,该操作需要 couchbase-server 服务暂时停止。 这是覆盖容器内的一些配置文件所必需的。操作步骤如下。
docker exec -it "bumblebase" bash -c "systemctl stop couchbase-server"
docker exec -it "bumblebase" bash -c "echo \"{rest_port, 3456}.\" >> \"/opt/couchbase/etc/couchbase/static_config\""
docker exec -it "bumblebase" bash -c "rm -rf /opt/couchbase/var/lib/couchbase/config/config.dat"
docker exec -it "bumblebase" bash -c "systemctl start couchbase-server"
运行它会给我以下错误;
Failed to connect to bus: No such file or directory
我只找到了一种解决方法,来自following stackoverflow answer。但是,我对修改 couchbase 默认图像并不满意,而且备用图像现在被标记为无人维护。
我也从couchbase documentation 尝试了这个备用命令:
docker exec -it "bumblebase" bash -c "service couchbase-server stop"
然后我又遇到了另一个错误:
couchbase-server: unrecognized service
我只想让 couchbase-server 服务在容器内停止,这可能吗?或者它是覆盖我的配置文件的替代解决方案?
【问题讨论】:
-
我们通常不运行
systemd来保持应用程序在容器内运行。您可能需要停止容器以执行更改(可能在外部卷中)。您介意分享您正在使用的基础映像吗? -
@GustavoKawamoto 我正在使用官方的 Couchbase 社区图片github.com/couchbase/docker/blob/…