Generators

Docker Compose Builder

Build a Docker Compose file with one or more services.

Add a service for each container, then set its image or build, ports, environment, volumes, networks, health check, logging, and resource limits.

Service 1

How to use Docker Compose Builder

Docker Compose Builder — Build a Docker Compose file for as many services as you add, from the image, ports, files, health check, and limits on each one. Free to use in D2i DevTools — no account required.

Steps

  1. Fill in Project name.
  2. Choose Compose version.
  3. Choose Network driver.
  4. Fill in Service name. This field is required.
  5. Fill in Image.
  6. Fill in Build context.
  7. Fill in Dockerfile.
  8. Fill in Build target.
  9. Fill in Build args (KEY=value, one per line).
  10. Fill in Container name.
  11. Fill in Hostname.
  12. Fill in Domain name.
  13. Fill in User.
  14. Fill in Working directory.
  15. Choose Platform.
  16. Choose Pull policy.
  17. Choose Restart.
  18. Set On-failure retries.
  19. Choose Command format.
  20. Fill in Command.
  21. Choose Entrypoint format.
  22. Fill in Entrypoint.
  23. Fill in Ports (one per line).
  24. Fill in Expose (one per line).
  25. Fill in Environment (KEY=value, one per line).
  26. Fill in Env files (one per line).
  27. Fill in Volumes (one per line).
  28. Fill in tmpfs paths (one per line).
  29. Fill in Devices (one per line).
  30. Fill in Extra hosts (one per line).
  31. Fill in DNS servers (one per line).
  32. Fill in DNS search domains (one per line).
  33. Choose Network mode.
  34. Fill in Networks (one per line).
  35. Fill in Depends on (one service per line).
  36. Fill in Labels (KEY=value, one per line).
  37. Fill in Add capabilities (one per line).
  38. Fill in Drop capabilities (one per line).
  39. Fill in Security options (one per line).
  40. Fill in Sysctls (KEY=value, one per line).
  41. Choose Logging driver.
  42. Fill in Log max size.
  43. Fill in Log max files.
  44. Fill in Health check command.
  45. Fill in Health check interval.
  46. Fill in Health check timeout.
  47. Set Health check retries.
  48. Fill in Health check start period.
  49. Fill in CPU limit.
  50. Fill in Memory limit.
  51. Fill in Memory reservation.
  52. Set PID limit.
  53. Fill in Shared memory size.
  54. Choose PID namespace.
  55. Choose IPC mode.
  56. Fill in MAC address.
  57. Fill in Stop grace period.
  58. Fill in Stop signal.
  59. Fill in GPUs.
  60. Fill in Profiles (one per line).
  61. Set the Keep STDIN open checkbox. Leave it off unless you want that set included.
  62. Set the Allocate a TTY checkbox. Leave it off unless you want that set included.
  63. Set the Privileged checkbox. Leave it off unless you want that set included.
  64. Set the Read-only root filesystem checkbox. Leave it off unless you want that set included.
  65. Set the Run an init process checkbox. Leave it off unless you want that set included.
  66. Set the Disable health check checkbox. Leave it off unless you want that set included.
  67. Click Run and copy the result under the form.

Frequently asked questions

What is Docker Compose Builder used for?

Use it to draft a compose file for the containers you are about to run, review, or commit.

How do I use the free online Docker Compose Builder tool?

Fill in Project name. Choose Compose version. Choose Network driver. Fill in Service name. This field is required. Fill in Image. Fill in Build context. Fill in Dockerfile. Fill in Build target. Fill in Build args (KEY=value, one per line). Fill in Container name. Fill in Hostname. Fill in Domain name. Fill in User. Fill in Working directory. Choose Platform. Choose Pull policy. Choose Restart. Set On-failure retries. Choose Command format. Fill in Command. Choose Entrypoint format. Fill in Entrypoint. Fill in Ports (one per line). Fill in Expose (one per line). Fill in Environment (KEY=value, one per line). Fill in Env files (one per line). Fill in Volumes (one per line). Fill in tmpfs paths (one per line). Fill in Devices (one per line). Fill in Extra hosts (one per line). Fill in DNS servers (one per line). Fill in DNS search domains (one per line). Choose Network mode. Fill in Networks (one per line). Fill in Depends on (one service per line). Fill in Labels (KEY=value, one per line). Fill in Add capabilities (one per line). Fill in Drop capabilities (one per line). Fill in Security options (one per line). Fill in Sysctls (KEY=value, one per line). Choose Logging driver. Fill in Log max size. Fill in Log max files. Fill in Health check command. Fill in Health check interval. Fill in Health check timeout. Set Health check retries. Fill in Health check start period. Fill in CPU limit. Fill in Memory limit. Fill in Memory reservation. Set PID limit. Fill in Shared memory size. Choose PID namespace. Choose IPC mode. Fill in MAC address. Fill in Stop grace period. Fill in Stop signal. Fill in GPUs. Fill in Profiles (one per line). Set the Keep STDIN open checkbox. Leave it off unless you want that set included. Set the Allocate a TTY checkbox. Leave it off unless you want that set included. Set the Privileged checkbox. Leave it off unless you want that set included. Set the Read-only root filesystem checkbox. Leave it off unless you want that set included. Set the Run an init process checkbox. Leave it off unless you want that set included. Set the Disable health check checkbox. Leave it off unless you want that set included. Click Run and copy the result under the form.

What can I paste or upload into Docker Compose Builder?

Each service needs a name and either an image or a build context. Use Add service for another container. Ports, environment, volumes, and networks are one entry per line. Restart starts as unless-stopped; choose do not set to leave it out.

What output does Docker Compose Builder give me?

A compose YAML document with every service you filled in. Named volumes and networks are declared at the bottom. Bind mounts that start with ./ or / are left as mounts only.

Is Docker Compose Builder free, and is my input private?

Yes — Your input is processed in memory for this request only. It is not saved to disk or the database, and it is cleared after the tool finishes.

How do I make one service wait for another?

Put the other service name in Depends on, one name per line. Use the same network name on both services if they should share a network. The network driver at the top applies to every network you name.

Inputs are processed in memory only and are not saved to disk or the database. Data exists only for the duration of your request.