The OpenCms Docker image contains all the necessary components and modules for local Mercury development. Like OpenCms and Mercury, the Docker image is open source and available on GitHub and Docker Hub.
In order to use the image, you have to install Docker on your computer at first. You should also be able to run simple commands in a console. Once you have installed Docker and familiarised yourself with the console, complete the following three steps.
services:
mariadb:
image: mariadb:latest
container_name: mariadb
init: true
restart: always
volumes:
- ~/dockermount/opencms-docker-mysql:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=secretDBpassword"
opencms:
image: alkacon/opencms-docker:latest
container_name: opencms
init: true
restart: always
depends_on: [ "mariadb" ]
links:
- "mariadb:mysql"
ports:
- "8080:8080"
volumes:
- ~/dockermount/opencms-docker-webapps:/container/webapps
command: ["/root/wait-for.sh", "mysql:3306", "-t", "30", "--", "/root/opencms-run.sh"]
environment:
- "DB_PASSWD=secretDBpassword"
No changes need to be made to the file for local development. If you are interested, you can read about configuration options in the README file.
- Step 2: Open a console, change to the directory of the docker-compose.yml file, and enter the following command:
docker compose up -d
This command downloads, installs and starts a MariaDB database and an OpenCms installation that contains the Mercury template.
- Step 3: The installation may take some time. You can track the progress of the installation by entering the following command in the console:
docker compose logs -f opencms
When the installation is complete, you can access your OpenCms installation at http://localhost:8080.