1

我正在尝试在运行“DEPLOYING ON DOCKER”示例。

Q1)当我调用部署在 docker 上的服务时,它给了我 500。

码头工人的日志说error: wso2.twitter:TwitterError, message: bad Authentication data.

似乎twitter.toml不在 docker 容器内。这是有道理的,因为我在下面的命令中从未提到在构建 docker 映像时存在这样的文件。

$ ballerina build hello_service.bal
$ docker run -d -p 9090:9090 registry.hub.docker.com/helloworld:v1.0
$ curl -d "Hello Ballerina" -X POST localhost:9090

如何提供配置文件?

Q2)registry这里有什么用?

// Docker configurations
@docker:Config {
    registry:"registry.hub.docker.com",
    name:"helloworld",
    tag:"v1.0"
}
4

2 回答 2

1

应将以下注释添加到芭蕾舞演员服务中。这会将芭蕾舞演员文件复制到 Docker 容器。声明 isBallerinaConf:true 会将 toml 文件传递​​给 ballerina run 命令。

@docker:CopyFiles {
    files: [{source: "./twitter.toml", target: "/opt/twitter.toml", isBallerinaConf: true}]
}

注册表用于将图像推送到远程 docker 注册表。

使用方法参考sample3。最终的 docker 镜像将是:

registry.hub.docker.com/helloworld:v.1.0

https://github.com/ballerinax/docker/tree/master/samples/sample3

于 2018-05-09T12:55:30.193 回答
1

对于芭蕾舞女演员 1.0.4 它

@docker:CopyFiles {
    files: [{sourceFile: "./ballerina.conf", target: "/opt/ballerina.conf", isBallerinaConf: true}]
}

根据 https://ballerina.io/learn/api-docs/ballerina/docker/records/FileConfig.html

于 2019-11-27T08:19:33.783 回答