在使用此版本安装芭蕾舞后,您好
我无法从我的芭蕾舞演员代码中生成docker图像:
import ballerina/http;
import ballerina/log;
import ballerinax/docker;
endpoint http:Listener PessoasEP {
port: 9095,
secureSocket: {
keyStore: {
path: "${ballerina.home}/bre/security/ballerinaKeystore.p12",
password: "ballerina"
}
}
};
@http:ServiceConfig {
basePath: "/"
}
@docker:Config {
registry:"devcamp2018",
name:"pessoas-docker",
tag:"1.0"
}
service getPessoas bind PessoasEP {
@http:ResourceConfig {
methods: ["GET"],
path: "/pessoas"
}
getPessoas(endpoint caller, http:Request req) {
http:Response res = new;
json p2 = [
{
fname: "Joao",
lname: "Silva"
},{
fname: "Roberto",
lname: "Monteiro"
}
];
res.setPayload(p2);
caller->respond(res) but {
error e => log:printError("Error in responding ", err = e)
};
}
}
除了安装芭蕾舞演员之外,还需要做什么吗?
发布于 2018-08-20 06:23:17
您只需安装Ballerina和Docker。然后执行以下命令,创建带有docker镜像的芭蕾舞可执行文件。
注释:使用给定的代码示例创建sample.bal
文件
$ ballerina run sample.bal
输出将如下所示:
Compiling source
sample.bal
Generating executable
sample.balx
@docker - complete 3/3
Run the following command to start a Docker container:
docker run -d devcamp2018/pessoas-docker:1.0
可以通过执行$ docker images
列出已创建的Docker镜像
REPOSITORY TAG IMAGE ID CREATED SIZE
devcamp2018/pessoas-docker 1.0 586bedf394bc About an hour ago 127MB
https://stackoverflow.com/questions/51882211
复制相似问题