Docker-compose yaml file for setting up modx

Helloooooo,
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'
services:
  mysql:
    image: mariadb
    volumes:
      - /website/mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: rebecca_modx31
      MYSQL_DATABASE: rebeccamodx
      MYSQL_USER: rebecca
    restart: always 
  modx:
    build: ./modxubuntu
    container_name: modxubuntu
    volumes:
      - /website/data:/var/www/html
    depends_on:
      - mysql
    links:
      - mysql
    restart: always
  nginx: 
    image: nginx:alpine
    container_name: modxnginx
    volumes:
      - /website/nginx:/etc/nginx/conf.d
      - /website/data:/var/www/html
    ports:
      - 8080:80
      - 443:443
    links:
      - 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 https://modx.com/download/downloading?id=60b109a106a0b762003d3162 \
  && 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”.