Use at your own peril
While the below options can be very powerful in the hands of a seasoned pro they are not for the faint of heart. Please be careful and note that YMMV. While we will make a good faith effort to support intrepid users please note that once you go down any of these paths you are more or less on your own!
You can use your own images by overriding any service to build from a
Dockerfile that lives somewhere inside your app. Here is an example that extends our base
php image to add another extension.
# Dockerfile example name: dockerfile # Start with the default LEMP recipe recipe: lemp # Override the recipe image with a build location services: appserver: # You probably want to set this to custom type: php:custom overrides: services: # This should relative to your app root build: ./php # Optionally specify a name and tag for the built image so you can # user it elsewhere later # # NOTE: Docker may throw a warning like: # WARNING: Image for service appserver was built because it did not already exist. # This is safe to ignore image: pirog/php:7.1-fpm-custom # This is not needed it only serves to illustrate how you can map internal container things # to your app directory for easy editability volumes: - ./config/custom.ini:/usr/local/etc/php/conf.d/zzzz-custom.ini - ./logs:/var/logs
FROM devwithlando/php:7.1-fpm RUN apt-get update -y \ && docker-php-ext-install pcntl
You can check out the full code for this example over here.
Our recipes and services layers are two levels of abstraction on top of the Docker compose v3 file format.
Lando will translate the configuration you specify for each recipe and/or service into relevant Docker Compose files and execute them at runtime. This gives you a lot of power to hypertune your services at the Docker Compose level.
You can pass Docker Compose config into each service using the
Here is an example of an overriden
apache service that uses a custom image and injects some additional environment variables.
services: html: type: apache:custom overrides: services: environment: STUFF: THINGS THINGS: GUYS image: pirog/myapache:2
Here is an example that uses a particular patch version of
services: appserver: type: nginx:custom overrides: services: image: nginx:1.12.1
You can also use our "catch all" service that allows power users to specify custom services that are not currently one of Lando's "supported" services. 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:
- Thinking about contributing your own custom Lando service and just want to prototype something
- Using Docker Compose config from other projects
- Need a service not currently provided by Lando itself
# The name of my app name: compose # Use the lando proxy to map to the custom service proxy: appserver: - compose.lndo.site # Configure my services services: # Create a service called "custom" appserver: # Use docker compose to create a custom service. type: compose # Specify the docker compose v3 services options here services: # Specify what container to run to provide the service. image: drupal:8 # Required. # You will need to investigate the images Dockerfile to find the "entrypoint" and "command" # and then define the command as `ENTRYPOINT COMMAND` # # You can also try a completely custom command but YMMV command: docker-php-entrypoint apache2-foreground # Spin up a DB to go with this database: type: mysql
You will need to rebuild your app with
lando rebuild to apply the changes to this file. You can check out the full code for this example over here.