Skip to content

使用 docker 部署 canal-server 无法使用 docker-restart 命令 #1001

@fotgu

Description

@fotgu
  • 现象
    当使用 docker 部署官方 canal-server 镜像(canal/canal-server:v1.1.0)并成功启动后,调用
docker restart

会有以下错误信息:

mv: cannot stat `/home/admin/canal-server/conf/example': No such file or directory
destination=`perl -le 'print $ENV{"canal.destinations"}'`
if [[ "$destination" =~ ',' ]]; then
    echo "multi destination:$destination is not support"
    exit 1;
else
    if [ "$destination" != "" ] && [ "$destination" != "example" ] ; then
        mv /home/admin/canal-server/conf/example /home/admin/canal-server/conf/$destination
    fi 
fi

这里的行为是每次启动时,如果指定了 destination 且 destination 的值不是 example,会把

/home/admin/canal-server/conf/example

目录重命名为指定的 destination 值。
由于我指定了 destination 且值不是 example,所以这个行为导致了执行

docker restart

时,由于容器内已经没有 example 文件夹,所以容器无法启动。

  • 问题
    各位大佬是如何解决这个问题的?自己打镜像还是有其他姿势?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions