Docker-compose yaml file for setting up modx

Im trying myself at using docker with modx. Could not find any prefab modx-images, so I started out making things a bit on my own but got halted by the error: modxubuntu exited with code 0

Does anyone know some sweet docker-setup? Would be great to have :wink:

Anyway here is what I got now, would be thankful for help! :wink:

This is my docker-compose file:

version: '3'
    image: mariadb
      - /website/mysql:/var/lib/mysql
      MYSQL_ROOT_PASSWORD: rebecca_modx31
      MYSQL_DATABASE: rebeccamodx
      MYSQL_USER: rebecca
    restart: always 
    build: ./modxubuntu
    container_name: modxubuntu
      - /website/data:/var/www/html
      - mysql
      - mysql
    restart: always
    image: nginx:alpine
    container_name: modxnginx
      - /website/nginx:/etc/nginx/conf.d
      - /website/data:/var/www/html
      - 8080:80
      - 443:443
      - modx

and here is my Dockerfile to extend the ubuntu image and pull the latest version of modx on it:

FROM ubuntu

ENV TZ=Europe/Berlin

RUN apt-get update \
  && echo "setting timezone" \
  && apt-get install -y tzdata \
  && ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \
  && echo $TZ > /etc/timezone \
  && dpkg-reconfigure --frontend noninteractive tzdata \
  && echo "setting timezone was a success" \
  && apt-get install -y apt-utils wget zip unzip \
  && mkdir -p /var/www/html \
  && cd /var/www/html \
  && wget \
  && chown -R www-data:www-data /var/www/html/ \
  && apt-get install -y php php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc \
  && echo "done"

Since this is a public forum, I really hope those aren’t your real DB credentials. If they are, I’d change them to some fake credentials in the message, and change the real ones on your server to something else.

1 Like

Have you tried this one?

1 Like

thanks, they are fake jepjepjep made them all up :wink:

Thanks! Yes I did try it, and now tried it once more and yes, it works good! Was just wondering if there was a way without using any unofficial images and so on.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.