Add and manage a custom service
Releasev0.35.0 · cfeceb67
This walkthrough adds a small internal container to an existing development environment, inspects it, and removes it. Use the same context for every command.
For file conventions, Compose override and web-routing examples, dashboard
discovery, and authentication behavior, read mw dev custom --help.
Define a service
Section titled “Define a service”Find the Compose file selected by the example service-set name:
mw dev custom --name custom-example whereCreate the file at the printed path with the following content. If that file
already exists, choose another custom- name and adjust the commands and
service name below. Do not overwrite an existing definition.
services: custom-example: image: busybox:1.37 command: ["sleep", "86400"] security_opt: - label:disable dns: - ${NETWORK_SUBNET_PREFIX}.10 networks: - dpsThis container runs for a day and publishes no web endpoint. Matching its
service name to the service-set name lets custom exec select it directly.
Start and inspect it
Section titled “Start and inspect it”mw dev custom --name custom-example createmw dev custom --name custom-example exec -- uname -aCheck the command output and find custom-example on the environment dashboard.
Allow its five-second status cache to refresh. The dashboard lists internal
services too, so a service can appear without a web UI link.
To adapt this example into a web service, follow the configuration examples in
mw dev custom --help and the gateway guide. They explain local
hostname access and authenticated public routes.
Stop, restart, and remove it
Section titled “Stop, restart, and remove it”mw dev custom --name custom-example stopmw dev custom --name custom-example startmw dev custom --name custom-example exec -- uname -aRemove the example container when finished:
mw dev custom --name custom-example destroyThen delete only the example Compose file you created. Refresh dashboard
metadata with mw dev where and reload after the status cache expires.
Read this guide offline with mw help guides dev custom-services.
Page views: —Sessions: —