Docker Start plugin

A plugin to start Magnolia using Docker and display the logs.

Package name

@magnolia/cli-docker-start-plugin

Repository link

Latest version

Magnolia CLI docker start plugin - latest version tag

Changelog link

By default, the docker-start command checks for Docker and Docker Compose, generates a docker-compose.yml file, starts the services in detached mode, watches for changes in webapps and light-modules folder, and shows logs with color-coded prefixes per service.

Use the Jumpstart plugin (see: Jumpstarting a project) to create a project directory.

Installing

The plugin doesn’t come pre-installed with Magnolia CLI. You must add it to the mgnl.config.js project file.

The plugin is installed automatically by the Jumpstart plugin if it is defined in a project template.

With add-plugin

Run the following command in the project folder.

npm run mgnl -- add-plugin @magnolia/cli-docker-start-plugin

Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:

npm run mgnl "--" ...

The command automatically downloads, installs, and registers the plugin in the mgnl.config.js file.

Manually

  1. Run the following command in the project folder.

    npm install @magnolia/cli-docker-start-plugin
  2. Modify the mgnl.config.js file accordingly.

    import DockerStartPlugin from "@magnolia/cli-docker-start-plugin";
    
    export default {
      plugins: [
        new DockerStartPlugin()
      ]
    };

Usage

Command

docker-start [options]

Options

Form (short and long) Description

-r

--regenerate

Regenerates the docker-compose.yml file if it already exists.

-t [path]

--tomcat [path]

Sets the path to the apache-tomcat directory or a directory containing it. By default, it uses the current working directory.

-lmp [path]

--light-modules-path [path]

Sets the path to the light-modules folder. By default, it uses the value in mgnl.config.js or prompts if not set.

-v

--version

Displays the version.

-h

--help

Displays help information.

Examples

Start Magnolia with Docker

npm run mgnl -- docker-start

Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:

npm run mgnl "--" ...

This command checks for Docker and Docker Compose, generates a docker-compose.yml if needed (using Tomcat and light modules paths), starts the services in detached mode, watches for changes, and follows logs with colored output for each service.

This setup is intended for development purposes only. The generated docker-compose.yml is a starting point. After the initial generation, you can modify it as needed to fit your environment (for example, services, volumes, ports, memory, or other settings).

Regenerate docker-compose and start

npm run mgnl -- docker-start --regenerate

Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:

npm run mgnl "--" ...

This command forces regeneration of the docker-compose.yml file before starting the Docker services, which is useful if the paths have changed.

Start with custom Tomcat and light modules paths

npm run mgnl -- docker-start --tomcat "./magnolia/apache-tomcat" --light-modules-path "./magnolia/light-modules"

Windows users using PowerShell must enclose the two consecutive hyphens (--) in quotes:

npm run mgnl "--" ...

This command starts Docker using the specified Tomcat directory and light modules path, generating or using docker-compose.yml accordingly, and displays colored service logs.

Configuration

You can set the following properties in mgnl.config.js to predefine the plugin’s behavior.

Global properties

Property name Description

lightModulesPath

The path to a directory containing all light modules.

Alternative forms: -lmp [path], --light-modules-path [path]

Plugin properties

Property name Description

tomcatPath

The path to the apache-tomcat directory.

Alternative forms: -t [path], --tomcat [path]

For more information, see Configuring plugins.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Magnolia CLI docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules