Closed masashi-sutou closed 3 years ago
The linked section in the README.md
includes this sentence:
When the container is started it will execute files with the extension .groovy that are found in /docker-entrypoint-initdb.d with the Gremlin Console.
Did you make sure that your script can be found at that location in the Docker container? You need to either mount a directory to that path or create your own Docker image based on the JanusGraph image where you then ADD
/COPY
your Groovy scripts in the Dockerfile
.
@FlorianHockmann
### ~janusgraph-docker/docker-compose.yml
version: "3"
services:
janusgraph:
build:
context: ./0.5
dockerfile: Dockerfile
# image: docker.io/janusgraph/janusgraph:latest
container_name: janusgraph-default
ports:
- "8182:8182"
volumes:
- "janusgraph-default-data:/var/lib/janusgraph"
volumes:
janusgraph-default-data:
### ~janusgraph-docker/0.5/Dockerfile
FROM debian:buster-slim as builder
ARG JANUS_VERSION=0.5.3
ARG YQ_VERSION=3.4.1
ENV JANUS_VERSION=${JANUS_VERSION} \
JANUS_HOME=/opt/janusgraph
WORKDIR /opt
RUN apt update -y && apt install -y gpg unzip curl && \
curl -fSL https://github.com/JanusGraph/janusgraph/releases/download/v${JANUS_VERSION}/janusgraph-${JANUS_VERSION}.zip -o janusgraph.zip && \
curl -fSL https://github.com/JanusGraph/janusgraph/releases/download/v${JANUS_VERSION}/janusgraph-${JANUS_VERSION}.zip.asc -o janusgraph.zip.asc && \
curl -fSL https://github.com/JanusGraph/janusgraph/releases/download/v${JANUS_VERSION}/KEYS -o KEYS && \
curl -fSL https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o yq && \
gpg --import KEYS && \
gpg --batch --verify janusgraph.zip.asc janusgraph.zip && \
unzip janusgraph.zip && \
mv janusgraph-${JANUS_VERSION} /opt/janusgraph && \
rm -rf ${JANUS_HOME}/elasticsearch && \
rm -rf ${JANUS_HOME}/javadocs && \
rm -rf ${JANUS_HOME}/log && \
rm -rf ${JANUS_HOME}/examples
COPY conf/ ${JANUS_HOME}/conf/gremlin-server/
COPY scripts/remote-connect.groovy ${JANUS_HOME}/scripts/
FROM openjdk:8-jre-slim-buster
ARG CREATED=test
ARG REVISION=test
ARG JANUS_VERSION=0.5.3
ENV JANUS_VERSION=${JANUS_VERSION} \
JANUS_HOME=/opt/janusgraph \
JANUS_CONFIG_DIR=/etc/opt/janusgraph \
JANUS_DATA_DIR=/var/lib/janusgraph \
JANUS_SERVER_TIMEOUT=30 \
JANUS_STORAGE_TIMEOUT=60 \
JANUS_PROPS_TEMPLATE=berkeleyje-lucene \
JANUS_INITDB_DIR=/docker-entrypoint-initdb.d \
gremlinserver.graphs.graph=/etc/opt/janusgraph/janusgraph.properties \
gremlinserver.threadPoolWorker=1 \
gremlinserver.gremlinPool=8
RUN groupadd -r janusgraph --gid=999 && \
useradd -r -g janusgraph --uid=999 -d ${JANUS_DATA_DIR} janusgraph && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends krb5-user && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p ${JANUS_INITDB_DIR} ${JANUS_CONFIG_DIR} ${JANUS_DATA_DIR}
COPY --from=builder /opt/janusgraph/ /opt/janusgraph/
COPY --from=builder /opt/yq /usr/bin/yq
COPY docker-entrypoint.sh /usr/local/bin/
COPY load-initdb.sh /usr/local/bin/
# copy groovy file
COPY add-vertex.groovy ${JANUS_INITDB_DIR}/
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh && \
chmod 755 /usr/local/bin/load-initdb.sh && \
chmod 755 /usr/bin/yq && \
chown -R janusgraph:janusgraph ${JANUS_HOME} ${JANUS_INITDB_DIR} ${JANUS_CONFIG_DIR} ${JANUS_DATA_DIR}
EXPOSE 8182
WORKDIR ${JANUS_HOME}
USER janusgraph
ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD [ "janusgraph" ]
LABEL org.opencontainers.image.title="JanusGraph Docker Image" \
org.opencontainers.image.description="Official JanusGraph Docker image" \
org.opencontainers.image.url="https://janusgraph.org/" \
org.opencontainers.image.documentation="https://docs.janusgraph.org/v0.5/" \
org.opencontainers.image.revision="${REVISION}" \
org.opencontainers.image.source="https://github.com/JanusGraph/janusgraph-docker/" \
org.opencontainers.image.vendor="JanusGraph" \
org.opencontainers.image.version="${JANUS_VERSION}" \
org.opencontainers.image.created="${CREATED}" \
org.opencontainers.image.license="Apache-2.0"
~janusgraph-docker/0.5/add-vertex.groovy
like README.md, then run docker compose -f docker-compose.yml up
.
~janusgraph-docker/build/docker-entrypoint-initdb.d/add-vertex.groovy
after referring to https://github.com/JanusGraph/janusgraph-docker#initialization, but I can't load the initial data likehercules
.docker-compose.yml
.I tried to run like the below