Search code examples
dockervolumedockerfiledockerhub

Docker build project from Docker Hub


I'd like to set up OpenProject using Docker. There are several decent options in the Hub, but so far I've tried this one as the best possible option. I'd like to clone it, change the database default password (because I find it unsafe) and then build it and run it. How should I proceed?

I've tried docker build -t myrepo/openproject dockerfile_location. Then I get an error that git does not exist. I know that I could add RUN apt-get install git, but afterwards I encounter an error checking for pg_config... no. In order to fix that, I need to install postgres, but this means that I have to put the code and data in the same container. This is the situation that I'm trying to avoid.

How can I solve the problem?


Solution

  • You don't have to put the postgres binaries and data in the same container. pg_config is basically configuring your postgres.

    pg_config is in postgresql-devel (libpq-dev in Debian/Ubuntu)

    In essence:

    # container were your data is
    docker run -d --name openproject-postgres-data -v /data busybox true
    # container were postgres runs
    docker run -d --name openproject-postgres --volumes-from openproject-postgres-data -e USER=super -e PASS=password paintedfox/postgresql
    # container that actually runs your application and links to your db container
    docker run -d --name openproject --link openproject-postgres:postgres -p 8080:80 abevoelker/openproject