Error while installing DSpace 6.4 in docker using docker-compose

241 views
Skip to first unread message

Kiran Dhakal

unread,
Aug 30, 2022, 7:38:38 AM8/30/22
to DSpace Community
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 https://www.youtube.com/watch?v=ovJ8sJk1Apg . 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
dspace.baseUrl = http://dspace:8080
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

Could anyone explain my mistake and point me towards the right direction?
Thank you
- Kiran
Screenshot from 2022-08-30 17-11-36.png

Tim Donohue

unread,
Aug 30, 2022, 11:12:40 AM8/30/22
to Kiran Dhakal, DSpace Community
Hi Kiran,

That error appears to be saying that it cannot find the "dspacedb" service you've created.  I'm not sure why that service isn't accessible...you may want to check the logs to see if it started properly, and see if you can access it yourself after it starts.

You also may want to take a closer look at the (development ready) Docker scripts we have in the DSpace 6.x codebase.  They provide you with clues on how to setup your Docker scripts.  Keep in mind, we've NEVER tested/run our Docker scripts in Production, so they may one work for development.



If you have additional questions, feel free to ask on the lists.  Keep in mind though that it could prove difficult to debug your Docker scripts for you...as sometimes the issue is more in your Docker network settings than in anything easily "visible" in your scripts.

Tim




From: dspace-c...@googlegroups.com <dspace-c...@googlegroups.com> on behalf of Kiran Dhakal <kirand...@gmail.com>
Sent: Tuesday, August 30, 2022 5:19 AM
To: DSpace Community <dspace-c...@googlegroups.com>
Subject: [dspace-community] Error while installing DSpace 6.4 in docker using docker-compose
 
--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-communi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-community/1bfb048a-f54b-491c-88e0-ed9616eb1e6fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages