Compose

This services is a "catch all" service that allows power users to specify custom services that are not currently one of Lando's supported services. You can easily add it to your Lando app by adding an entry to the services top-level config in your Landofile.

Technically speaking, this service is just a way for a user to define a service directly using the Docker Compose V3 file format.

THIS MEANS THAT IT IS UP TO THE USER TO DEFINE A SERVICE CORRECTLY.

This service is useful if you are:

  1. Thinking about contributing your own custom Lando service and just want to prototype something
  2. Using Docker Compose config from other projects
  3. Need a service not currently provided by Lando itself

Configuration

Unlike other services, compose does not require a version, instead it allows you to directly configure Docker Compose's top-level volumes, networks, and services config directly.

We highly recommend you check the Docker Compose docs!

services, volumes and networks below come directly from Docker Compose so we highly recommend you check out their docs.

services:
  custom-service:
    type: compose
    services:
      image: drupal:8
      # Required. See Below
      command: docker-php-entrypoint apache2-foreground
      ports:
        - '80'
    volumes:
      my-volume:
    networks:
      my-network:

Note that while compose services also get the same Lando secret sauce but there is a notable difference here. By default Lando will hijack the Docker containers entrypoint. This means if your custom container set's its own entrypoint you will need to remove that entrypoint and set it as the first argument in the command.

In the example above docker-php-entrypoint is the default entrypoint for the drupal:8 image but we have moved it so that it is the first argument of command. This both allows the container to run as expected and allows Lando to do its thing.

Example

If you are interested in a working example of this service that we test on every Lando build then check out https://github.com/lando/lando/tree/master/examples/compose

Additional Reading

Guides and Tutorials

Advanced Usage

Known Issues

Troubleshooting

results matching ""

    No results matching ""