当前位置: 首页 > 知识库问答 >
问题:

docker compose up命令设置两次环境变量

郝冥夜
2023-03-14

我在yaml文件中定义了一个环境变量JAVA_TOOL_OPTIONS。当我使用命令“docker compose-f up”启动容器时,我会出现以下错误:

拾取JAVA_TOOL_OPTIONS:-agentlib: jdwp=传输=dt_socket, address=8010, server=y,挂起=n监听传输dt_socketat address: 8010拾取JAVA_TOOL_OPTIONS:-agentlib: jdwp=传输=dt_socket, address=8010, server=y,挂起=n错误:无法加载此JVM TI代理两次,检查您的java命令行是否有重复的jdwp选项。初始化VM代理库时发生错误未能初始化:jdwp

看起来JAVA_工具_选项设置了两次。任何帮助都将不胜感激

下面是我的. yaml文件:

version: '3.1'
services:

  blumeglobal:
    build:
      context: .
      dockerfile: Dockerfile
    image: corda-3.2
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10003:10003"
      - "10004:10004"
      - "10005:10005"
    image: corda:3.2
    container_name: blumeglobal
    volumes:
      - ./build/nodes/BlumeGlobal/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/BlumeGlobal/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/BlumeGlobal/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/BlumeGlobal/node.conf:/opt/corda/node.conf
      - ./build/nodes/BlumeGlobal/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/BlumeGlobal/certificates/:/opt/corda/certificates/
    networks:
      - mynetwork

  bestbuy:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10012:10002"
      - "10013:10003"
      - "10014:10004"
      - "10015:10015"
    image: corda:3.2
    container_name: bestbuy
    volumes:
      - ./build/nodes/Bestbuy/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/Bestbuy/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/Bestbuy/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/Bestbuy/node.conf:/opt/corda/node.conf
      - ./build/nodes/Bestbuy/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/Bestbuy/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  expeditors:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
      - JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=8010,server=y,suspend=n
    ports:
      - "10022:10002"
      - "10023:10003"
      - "10024:10004"
      - "10025:10025"
      - "8010:8010"
    image: corda:3.2
    container_name: expeditors
    volumes:
      - ./build/nodes/Expeditors/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/Expeditors/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/Expeditors/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/Expeditors/node.conf:/opt/corda/node.conf
      - ./build/nodes/Expeditors/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/Expeditors/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  motorcarrier:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10032:10002"
      - "10033:10003"
      - "10034:10004"
      - "10035:10035"
    image: corda:3.2
    container_name: motorcarrier
    volumes:
      - ./build/nodes/DTDC/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/DTDC/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/DTDC/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/DTDC/node.conf:/opt/corda/node.conf
      - ./build/nodes/DTDC/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/DTDC/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  one:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10042:10002"
      - "10043:10003"
      - "10044:10004"
      - "10045:10045"
    image: corda:3.2
    container_name: one
    volumes:
      - ./build/nodes/ONE/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/ONE/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/ONE/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/ONE/node.conf:/opt/corda/node.conf
      - ./build/nodes/ONE/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/ONE/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  cisco:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10052:10002"
      - "10053:10003"
      - "10054:10004"
      - "10055:10055"
    image: corda:3.2
    container_name: cisco
    volumes:
      - ./build/nodes/Cisco/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/Cisco/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/Cisco/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/Cisco/node.conf:/opt/corda/node.conf
      - ./build/nodes/Cisco/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/Cisco/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  foxconn:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10062:10002"
      - "10063:10003"
      - "10064:10004"
      - "10065:10065"
    image: corda:3.2
    container_name: foxconn
    volumes:
      - ./build/nodes/Foxconn/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/Foxconn/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/Foxconn/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/Foxconn/node.conf:/opt/corda/node.conf
      - ./build/nodes/Foxconn/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/Foxconn/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

  toshiba:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - JAVA_OPTIONS=-Xmx512m
    ports:
      - "10072:10002"
      - "10073:10003"
      - "10074:10004"
      - "10075:10075"
    image: corda:3.2
    container_name: toshiba
    volumes:
      - ./build/nodes/Toshiba/network-parameters:/opt/corda/network-parameters
      - ./build/nodes/Toshiba/persistence.mv.db:/opt/corda/persistence.mv.db
      - ./build/nodes/Toshiba/additional-node-infos/:/opt/corda/additional-node-infos/
      - ./build/nodes/Toshiba/node.conf:/opt/corda/node.conf
      - ./build/nodes/Toshiba/cordapps/:/opt/corda/cordapps/
      - ./build/nodes/Toshiba/certificates/:/opt/corda/certificates/
    depends_on:
      - blumeglobal
    networks:
      - mynetwork

networks:
  mynetwork:
    external: true

下面是我的Dockerfile

FROM openjdk:8u151-jre-alpine

# Override default value with 'docker build --build-arg BUILDTIME_CORDA_VERSION=version'
# example: 'docker build --build-arg BUILDTIME_CORDA_VERSION=1.0.0 -t corda/node:1.0 .'
ARG BUILDTIME_CORDA_VERSION=3.2-corda
ARG BUILDTIME_JAVA_OPTIONS

ENV CORDA_VERSION=${BUILDTIME_CORDA_VERSION}
ENV JAVA_OPTIONS=${BUILDTIME_JAVA_OPTIONS}

# Set image labels
LABEL net.corda.version = ${CORDA_VERSION} \
      maintainer = "<blockchainservice@infosys.com>" \
      vendor = "infosys"

RUN apk upgrade --update && \
    apk add --update --no-cache bash iputils && \
    rm -rf /var/cache/apk/* && \
    # Add user to run the app && \
    addgroup corda && \
    adduser -G corda -D -s /bin/bash corda && \
    # Create /opt/corda directory && \
    mkdir -p /opt/corda/plugins && \
    mkdir -p /opt/corda/logs

# Copy corda jar
ADD --chown=corda:corda https://dl.bintray.com/r3/corda/net/corda/corda/${CORDA_VERSION}/corda-${CORDA_VERSION}.jar                       /opt/corda/corda.jar

COPY run-corda.sh /run-corda.sh
RUN chmod 777 /opt/corda && chmod +x /run-corda.sh && \
    sync && \
    chown -R corda:corda /opt/corda

# Expose port for corda (default is 10002) and RPC
EXPOSE 10002
EXPOSE 10003
EXPOSE 10004
EXPOSE 10005 10015 10025 10035 10045 10055 10065 10075

# Working directory for Corda
WORKDIR /opt/corda
ENV HOME=/opt/corda
USER corda

# Start it
CMD ["/run-corda.sh"]

共有1个答案

壤驷文华
2023-03-14

为dockerfile尝试另一个基本java映像。(例如“来自azul/zulu openjdk:8u192”)

下面是一个你想做的事情的例子,你可以在这里找到:https://github.com/EricMcEvoyR3/corda-docker-compose(你会注意到他甚至没有设置JAVA_工具_选项变量

您还需要注意Corda中有一个dockerform任务可以为您生成任务:https://docs.corda.net/docs/corda-os/4.4/generating-a-node.html#the-dockerform-task

看起来您在复制dokcer compose文件中的正确信息,只需再看一看这些示例,看看您是否能够实现这一点。

祝你在构建区块链的冒险中好运。

 类似资料:
  • 本文向大家介绍cmd环境变量命令set 设置永久环境变量命令setx,包括了cmd环境变量命令set 设置永久环境变量命令setx的使用技巧和注意事项,需要的朋友参考一下 set命令 set命令用于设置当前cmd窗口中的环境变量,只在当前cmd窗口有效,cmd窗口关闭后将会失效,而其不会影响到系统中保存的用户环境变量。 setx命令 setx设置永久用户环境变量 setx env_name env

  • ENV 设置环境变量 格式有两种: ENV <key> <value> ENV <key1>=<value1> <key2>=<value2>... 这个指令很简单,就是设置环境变量而已,无论是后面的其它指令,如 RUN,还是运行时的应用,都可以直接使用这里定义的环境变量。 ENV VERSION=1.0 DEBUG=on \ NAME="Happy Feet" 这个例子中演示了如何换行,以

  • 问题内容: 我在运行show时有一个file.sh:未设置TERM环境变量。 问题答案: 您可以看到它是否真的没有 设置 。运行命令。 如果没有,则可以这样设置:

  • 3.1.1.设置PATH环境变量 Android SDK里有个目录,主要的工具都在里面。我们将会频繁地用到这些工具,因此把你的~/android-sdk/tools/目录加入系统的环境变量PATH会是个好办法,这一来就不需要每次使用它们时都切换目录了。 不同系统设置环境变量的方式各有不同,详见Installing Android SDK页面中的第二步。 (译注:Installing Android

  • 当我加载我的应用程序时,我得到这个: 我正在尝试遵循这个:谷歌视觉文档 我已经运行了命令: 然后在客户端 Libary 上,它说我必须设置一个客户端库?我已经用他所有正确的事情做了这件事,然后它说- 接下来,通过将环境变量GOOGLE_APPLICATION_CREDENTIALS设置为指向在上一步中下载的JSON文件,为应用程序代码提供凭据。 并执行以下操作:< code >设置GOOGLE _

  • 我的Python程序有问题。在IDE(间谍IDE)上运行此程序时,我没有得到任何错误,并且它工作得很好。否则,如果我在python IDLE中运行它,我会得到以下错误。 我认为这个错误与Python路径环境变量有关,因为我找不到该模块。