Deploy with Docker Compose
App Platform allows you to deploy an application using a Docker Compose file located in the repository. This enables running any type of application, including those built with frontend and backend frameworks not directly supported by the service.
Requirements Copy link
File Location Copy link
The Dockerfile and docker-compose.yml file must be located in the root of the connected repository. If the Dockerfile is located elsewhere, its path must be explicitly specified in the docker-compose.yml manifest. For example:
services:
app:
build:
context: ./app # Path to the application source code
dockerfile: ./docker/Dockerfile.prod # Explicit path to the Dockerfile
Reserved Ports Copy link
Do not use ports 80 and 443 as host ports in the manifest. These ports are reserved for Nginx.
Proxying Copy link
Proxying is configured for the first service listed in docker-compose.yml. Other services, if they have host ports defined, will be accessible only via those explicit ports. For example:
services:
my-app:
ports:
- "9000:80"
adminer:
ports:
- "8080:8080"In this case, my-app will be available at the main domain, and adminer will be available at http://<domain>:8080.
Restrictions on docker-compose.yml Copy link
The following restrictions apply to docker-compose.yml. Attempting to deploy a manifest containing any of these directives or parameters will result in an error.
Disallowed directives
The following directives cannot be used in docker-compose.yml:
cap_addcgroupcgroup_parentdevice_cgroup_rulesdevicesextendsextra_hostsincludeipcnetwork_mode: container:...pidprivilegedsecurity_optsysctlsuse_api_socketuserns_modeutsvolumesvolumes_from
Disallowed parameters
The following parameters are prohibited:
externalin thevolumes,networks,configs, andsecretssectionsdriver_optsname
Path traversal
Path traversal outside the allowed directory in the file value for configs and secrets is prohibited.
Network Mode Copy link
The host network mode is not supported when configuring networking.
Step 1. Connect Your Repository Copy link
You can connect a repository in one of two ways:
From your GitHub, GitLab, or BitBucket account
- Click on the platform name.
- Log in to your account.
- Select the desired repository in your Hostman dashboard.
If you are already logged in, Hostman will immediately show the available repositories. Choose the one you need.
By URL
You can connect any repository from any platform by providing its Git URL.
- Click Connect the repository via URL.
- Enter the Git URL of the repository.
- If the repository is private, also enter the access details.
Read more about connecting repositories here.
Step 2. Select Branch and Commit Copy link
Branch
Select a branch for deployment.
The menu displays the 200 most recent branches, as well as the default branch (master, main, or default) if the repository is connected via GitHub, GitLab, or Bitbucket.
Commit
Leave the Build by the last executed commit option enabled if you want App Platform to deploy the latest commit and automatically rebuild the application when you add new commits to the repository. You can disable automatic deployment in the future.
If you want to select a specific commit, disable this option. Note that it will also disable automatic deployments.
Step 3. Select Server Region and Configuration Copy link
Region
Your application must run on a separate cloud server. Select the region where the server should be located.
Configuration
Select the server configuration. You can always upgrade your server later, however, downgrading will not be possible.
Step 4. Configure Additional Settings Copy link
App Platform reads the instructions from docker-compose.yml and builds the application accordingly.
Here you can add the app to a private network and set up enviroment variables, if necessary.
Click Show advanced settings to configure them.
Private Network
You can add the application to a private network and specify the IP address the app will use.
Apps with a private IP address may experience a short downtime during redeployment, as existing ports need to be freed up before the new version starts.
Variables
If variables are already specified in docker-compose.yml or in the Dockerfile, there's no need to duplicate them.
Environment variables can be used both during the build stage and at application runtime. To use variables as build arguments, pass them to docker-compose.yml as follows:
build:
context: .
args:
- ARGUMENT_VAR=${example_var}After that, the variable can be referenced in the Dockerfile:
ARG ARGUMENT_VAR=${example_var}Step 5. Enter the App Information Copy link
Specify a name and a comment for your application to be displayed in the Hostman dashboard. You can also select a project to add the app to.
These settings can also be changed later.
Step 6. Deploy Copy link
Click Create. Once the process starts, you will see the deployment log on the Deploy tab.
The deploy log contains all the necessary information to solve possible issues. If something goes wrong, for example, due to errors in the code, the deploy log will display the notification about it specifying the cause of the problem.
When you first deploy a project, the server installation may take some time. Once the process is completed, the application status will be updated, and you will also see a message about this in the log.
All done!
You can find the application's IP address and the technical domain linked to the app in the Dashboard tab. To add your own domain to the app, follow this guide.
The application runs on ports 80 and 443.
In the future, App Platform will monitor updates in the repository and, if automatic deployment is enabled, automatically rebuild the project with new changes.