Skip to content
zefıly

How to host a Docker Compose app on your own server

If your app already has a Compose file, Zefily can run it as a site. Only the service you publish is reachable from the web; the other services stay on a private network inside the site. Containers run rootless with Podman.

Before you start

  • A server connected to Zefily. Containers need no extra install: the agent provides rootless Podman and podman-compose.
  • A repository with a Compose file, and a service that listens on a container port.
  • The settings and secrets your app needs, ready to go into the site's .env.

Steps

  1. 1. Prepare the Compose file

    Keep the ports entries for local use. On the server Zefily removes them and makes only the published service reachable, on 127.0.0.1, for the domain.

  2. 2. Choose the published service

    The published service is the Compose service that your domain points to. It must listen on the container port named in the Compose file.

  3. 3. Keep data folders in the repository

    Data folders mounted from the repository are moved to the site's shared folder on the first deploy, so they survive every release.

  4. 4. Add the site from your repository

    Add a container site from your repository. Set the Compose file field to your file and the Published service field to the service that serves the web.

  5. 5. Set the environment

    Put settings and secrets in the site's .env. A Dockerfile build reads it as a secret, and it is never stored in the image.

  6. 6. Pin the image tags

    For any service that pulls an image, use tags you control, such as 1.4.2, rather than latest. You then know which version runs.

  7. 7. Deploy

    Click Deploy now. Zefily starts the Compose file with podman-compose and points the domain at the published service. The deploy log shows each step.

  8. 8. Use the Shell for other services

    For a stack with several services, pick the service in the Shell list. The default is the main service of the stack.

Verify it works

Open the domain: the published service answers over HTTPS. The deploy log ends with the service running, and a command in the Shell for that service returns the output you expect.

Troubleshooting

The domain returns 502
The published service does not listen on the container port named in the Compose file, or it exits at start. Check the port in your app and the Published service field.
Compose ports are ignored
That is by design: the server removes the ports entries, and only the published service is reachable through the domain.
The deploy refuses a setting
Privileged containers, host networking, the host PID or IPC namespace, devices and added capabilities are refused. Remove those settings from the Compose file.

Questions

Do I need a Dockerfile?

No, when your services use published images. A Dockerfile at the root of the repository builds the image on each deploy instead.

Can I run a single image without Compose?

Yes. A single-container site runs one image and switches to a new release without a gap, the new container must answer before traffic moves.

Does it run without root?

Yes. Containers run rootless with Podman for the site user, so a container cannot take over the server.

Read next

Start on a server you own

Create your account, connect a server and follow the guide. The server stays yours: you pay your provider.

Start free

Black Friday & Cyber Monday

Before you go: lifetime plans are on sale

Pay once for a lifetime plan, or get 30% off the first year of any yearly plan.

Only 100 lifetime plans per plan. When they are gone, they are gone.

See the campaign

Amazing November

See the campaign →