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;
正如您所见,转义单引号不起作用...有什么想法吗?