0

嗨,使用此版本安装芭蕾舞女演员后

https://product-dist.ballerina.io/nightly/0.981.1-SNAPSHOT/ballerina-platform-linux-installer-x64-0.981.1-SNAPSHOT.rpm

我无法从我的芭蕾舞演员代码中生成 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) 
    };
}
}

除了安装芭蕾舞演员之外,还有什么需要做的吗?

4

1 回答 1

1

You have to install Ballerina and Docker only. Then execute the following command to create the ballerina executable file with docker image.

NOTE: Create a sample.bal file with the given code sample

$ ballerina run sample.bal

The output will be as follows:

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

Created Docker image can be listed by executing $ docker images

REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
devcamp2018/pessoas-docker           1.0                 586bedf394bc        About an hour ago   127MB
于 2018-08-20T06:23:17.150 回答