I wanted to install DSpace 6.4 using the source release in docker using docker-compose. I copied most of the docker-compose file from the tutorial in
. Instead of the image that they used for dspace service, I wrote a Dockerfile using steps given in the installation manual.
My docker-compose file looks like the following:
version: "3.3"
services:
dspacedb:
image: dspace/dspace-postgres-pgcrypto
# Note that a separate image exists for DSpace 4x
# image: dspace/dspace-postgres-4x
container_name: dspacedb
environment:
- PGDATA=/pgdata
volumes:
- pgdata:/pgdata
networks:
- dspacenet
tty: true
stdin_open: true
dspace:
build: ./dspace
container_name: dspace
environment:
- DSPACE_INSTALL=dspace
- SCRIPTVER=6
ports:
- 8080:8080
volumes:
- "assetstore:/dspace/assetstore"
- "solr:/dspace/solr"
# - "/add-ons/mirage2/xmlui.xconf:/dspace/config/xmlui.xconf"
networks:
- dspacenet
depends_on:
- dspacedb
tty: true
stdin_open: true
volumes:
pgdata:
assetstore:
solr:
networks:
dspacenet:
My Dockerfile:
FROM ubuntu:18.04
RUN useradd -m dspace
WORKDIR /dspace
COPY . .
RUN apt-get update
RUN apt-get install unzip
RUN apt-get install openjdk-8-jdk -y
RUN apt-get install git -y
RUN apt-get install ant -y
RUN apt-get install maven -y
RUN unzip dspace-6.4-src-release.zip
COPY ./local.cfg dspace-6.4-src-release/dspace/config/
RUN mkdir dspace
RUN chown dspace dspace
RUN su - dspace
RUN cd dspace-6.4-src-release && mvn package
RUN cd dspace-6.4-src-release/dspace/target/dspace-installer && ant fresh_install
RUN cp -r dspace-6.4-src-release/dspace/webapps/* /tomcat/webapps
RUN /etc/init.d/tomcat start
RUN dspace-6.4-src-release/dspace/bin/dspace create-administrator
In the Dockerfile, I copied ./local.cfg where I have configured the following:
dspace.dir = dspace-6.4-src-release/dspace
dspace.hostname = dspace
db.url = jdbc:postgresql://dspacedb:5432/dspace
Rest of the content is from the file local.cfg.EXAMPLE from the source release.
I put the dspace.hostname as dspace because of the container's name in docker-compose.yml file. I am not sure if that is the right thing to do.
And for the same reason, the value of db.url also contains dspacedb.
I tried the command docker-compose up --build from my terminal. The mvn package command runs successfully. But I get an error on command ant fresh_install. The error is in the screenshot. I have tried by changing the default hostnames and url but I always get the error similar to UnknownHost : dspacedb