我使用以下 Dockerfile为 WSO2 流处理器编辑器配置文件实现了一个示例 Docker 映像:
FROM ubuntu:16.04
MAINTAINER WSO2 Docker Maintainers "dev@wso2.org"
# set user configurations
ARG USER=wso2carbon
ARG USER_GROUP=wso2
ARG USER_HOME=/home/${USER}
# set dependant files directory
ARG FILES=./files
# set jdk configurations
ARG JDK_ARCHIVE=jdk-8u*-linux-x64.tar.gz
ARG JAVA_HOME=${USER_HOME}/java
# set wso2 product configurations
ARG WSO2_SERVER=wso2sp
ARG WSO2_SERVER_VERSION=4.0.0
ARG WSO2_SERVER_PACK=${WSO2_SERVER}-${WSO2_SERVER_VERSION}*.zip
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}-${WSO2_SERVER_VERSION}
# install required packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
curl \
iproute2 \
telnet \
unzip && \
rm -rf /var/lib/apt/lists/*
# create a user group and a user
RUN groupadd --system ${USER_GROUP} && \
useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP} ${USER}
# copy the jdk and wso2 product distribution zip files to user's home directory
COPY ${FILES}/${JDK_ARCHIVE} ${FILES}/${WSO2_SERVER_PACK} ${USER_HOME}/
# install the jdk, wso2 server, remove distributions and set folder permissions
RUN mkdir -p ${JAVA_HOME} && \
tar -xf ${USER_HOME}/${JDK_ARCHIVE} -C ${JAVA_HOME} --strip-components=1 && \
unzip -q ${USER_HOME}/${WSO2_SERVER_PACK} -d ${USER_HOME}/ && \
rm ${USER_HOME}/${JDK_ARCHIVE} && \
rm ${USER_HOME}/${WSO2_SERVER_PACK} && \
chown -R ${USER}:${USER_GROUP} ${USER_HOME} && \
chmod -R g=u ${USER_HOME}
# set the user and work directory
USER ${USER}
WORKDIR ${USER_HOME}
# set environment variables
ENV JAVA_HOME=${JAVA_HOME} \
PATH=$JAVA_HOME/bin:$PATH \
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}
# expose ports
EXPOSE 9390 9715 9615 7714 7614
ENTRYPOINT ${WSO2_SERVER_HOME}/bin/editor.sh
在构建上述 Docker 映像时,您将提供 Oracle JDK 和WSO2 流处理器分布(files
Docker 构建上下文中的目录必须包含这些分布)。
我已经运行了创建的 Docker 映像
docker run -it -p 9390:9390 wso2sp:4.0.0
并且没有端口
docker run -it wso2sp:4.0.0
转发,但我无法从端口 9390 访问编辑器 UI。如下面的日志所示,我们应该能够通过 URL 访问服务
http://localhost:9390/editor (when port forwarding)
或者通过
http://<private_container_IP>:9390/editor (no port forwarding)
我也通过日志发现服务器已经启动成功了,如下:
JAVA_HOME environment variable is set to /home/wso2carbon/java
CARBON_HOME environment variable is set to /home/wso2carbon/wso2sp-4.0.0
RUNTIME_HOME environment variable is set to /home/wso2carbon/wso2sp-4.0.0/wso2/editor
[2017-12-25 22:47:44,035] INFO {org.wso2.carbon.launcher.extensions.OSGiLibBundleDeployerUtils updateOSGiLib} - Successfully updated the OSGi bundle information of Carbon Runtime: editor
osgi> [2017-12-25 22:47:46,187] INFO {org.wso2.msf4j.internal.websocket.WebSocketServerSC} - All required capabilities are available of WebSocket service component is available.
[2017-12-25 22:47:46,190] INFO {org.wso2.carbon.metrics.core.config.model.JmxReporterConfig} - Creating JMX reporter for Metrics with domain 'org.wso2.carbon.metrics'
[2017-12-25 22:47:46,211] INFO {org.wso2.carbon.metrics.core.reporter.impl.AbstractReporter} - Started JMX reporter for Metrics
[2017-12-25 22:47:46,269] INFO {org.wso2.msf4j.analytics.metrics.MetricsComponent} - Metrics Component is activated
[2017-12-25 22:47:46,274] INFO {org.wso2.carbon.databridge.agent.internal.DataAgentDS} - Successfully deployed Agent Server
[2017-12-25 22:47:46,307] INFO {org.wso2.msf4j.internal.websocket.EndpointsRegistryImpl} - Endpoint Registered : /console
[2017-12-25 22:47:46,457] INFO {org.wso2.carbon.event.simulator.core.service.CSVFileDeployer} - CSV file deployer initiated.
[2017-12-25 22:47:46,460] INFO {org.wso2.carbon.event.simulator.core.service.SimulationConfigDeployer} - Simulation config deployer initiated.
[2017-12-25 22:47:46,463] INFO {org.wso2.carbon.siddhi.editor.core.internal.WorkspaceDeployer} - Workspace artifact deployer initiated.
[2017-12-25 22:47:46,518] INFO {org.wso2.carbon.cluster.coordinator.rdbms.internal.RDBMSCoordinationServiceComponent} - Cluster coordination has been disabled. Enable it in deployment.yaml to use the clustering service
[2017-12-25 22:47:46,645] INFO {org.wso2.carbon.stream.processor.statistics.api.StatisticsApi} - org.wso2.carbon.stream.processor.statistics.api.StatisticsApi service component has started.
[2017-12-25 22:47:46,759] INFO {org.wso2.carbon.siddhi.editor.core.internal.StartupComponent} - Editor Started on : http://localhost:9390/editor
[2017-12-25 22:47:46,762] INFO {org.wso2.msf4j.internal.MicroservicesServerSC} - All microservices are available
[2017-12-25 22:47:46,825] INFO {org.wso2.transport.http.netty.listener.ServerConnectorBootstrap$HTTPServerConnector} - HTTP(S) Interface starting on host 127.0.0.1 and port 9390
[2017-12-25 22:47:46,828] INFO {org.wso2.transport.http.netty.listener.ServerConnectorBootstrap$HTTPServerConnector} - HTTP(S) Interface starting on host 0.0.0.0 and port 9743
[2017-12-25 22:47:46,888] INFO {org.wso2.carbon.databridge.receiver.binary.internal.BinaryDataReceiver} - Started Binary SSL Transport on port : 9715
[2017-12-25 22:47:46,889] INFO {org.wso2.carbon.databridge.receiver.binary.internal.BinaryDataReceiver} - Started Binary TCP Transport on port : 9615
[2017-12-25 22:47:46,897] INFO {org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver} - Thrift Server started at 0.0.0.0
[2017-12-25 22:47:46,911] INFO {org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver} - Thrift SSL port : 7714
[2017-12-25 22:47:46,913] INFO {org.wso2.carbon.databridge.receiver.thrift.ThriftDataReceiver} - Thrift port : 7614
[2017-12-25 22:47:46,917] INFO {org.wso2.carbon.databridge.core.internal.DataBridgeDS} - Successfully deployed Agent Server
[2017-12-25 22:47:46,930] INFO {org.wso2.carbon.kernel.internal.CarbonStartupHandler} - WSO2 Stream Processor started in 3.181 sec
是什么导致无法访问正在运行的服务?任何建议和想法都将受到高度赞赏。