Your Docker server is ready
Docker and Docker Compose are installed, a reverse proxy serves this name over HTTPS, and the firewall is on. Log in over SSH and deploy your first container.
Publish an app on your domain
This page is served on the name you gave this server. Each of your own apps gets a name of its own, and the proxy gets a certificate for it.
1. Point an A record for your app's name, for example myapp.example.com, to this server's IP address.
2. Make a folder for the app:
mkdir -p /opt/myapp
cd /opt/myapp
3. Save this in the folder as compose.yml, with your image, your app's name, and the port your app listens on inside the container in place of 3000:
services:
app:
image: your-image
restart: unless-stopped
labels:
caddy: myapp.example.com
caddy.reverse_proxy: "{{upstreams 3000}}"
networks:
- web
networks:
web:
external: true
The two labels tell the proxy the name and the port. The network web is the one the proxy reaches your containers on, so the app needs no ports: line. restart: unless-stopped starts it again after a reboot.
4. Start it, from the same folder:
docker compose up -d
Open https://myapp.example.com once the name points here. The first visit can take a few seconds while the certificate is issued. To change the app later, edit compose.yml and run docker compose up -d again.
Other ports
A port you publish with ports: (other than 80 and 443) stays closed in the firewall until you open it, for example rc port open 5432/tcp, and rc port close 5432/tcp closes it again.
Commands
rc status this server and your containers
rc logs myapp-app-1 follow one container's logs
rc port open 5432/tcp open a port
rc port list show the open ports