I'm wondering if there are some best practices to deploy Docker images to Digital Ocean using Terraform.

Because I don't expect much load and don't need failover features etc. I'm not aiming to deploy to kubernetes. At least not for the moment. I just wanna deploy a standalone Docker app.

This leads me to the question whether there are some best practices on how to deploy Docker images via Terraform. To it seemls like I can use (1) App platform or (2) provision a droplet with docker and run the image inside the droplet myself.

I'd prefer to deploy to the App platform. But I don't have a handle on how I can use public images from DockerHub. The App platform itself (via WebIU) supports this. But from the Terraform docs I cannot get a handle on this.

As far as I see it, the app platform is simpler and more straight forward for Docker images. Plus I don't have to setup that many domain-information (I wanna point my existing docs.sommerfeld.io to the App). Downside is that I have to setup a CNAME entry with my Domain Hoster to a .digitalocean.app URL which maybe I cannot do automatically. Plus as said I don't know how to use a public image from DockerHub.

Using the droplet means I would have to do more stuff on my own

  • Provisioning the droplet as well as making sure all needed software is installed and my docker image is started
  • More domain and CNAME configs on my own
  • Setting up https with certs (from let's enctypt) on my own.

So to summarize, here are my questions:

  1. Do I understand everything I described correctly? Or am I mistaken somewhere?
  2. Are there some best practices I should follow? How would you tackle my issue? I don't really have a starting point so a push in the right direction would really help me out.

Thanks guys and best regards. Sebastian

  • When you trade a management platform like Kubernetes, you have to make up for a lot of what it would provide on your own. At its core, containers operate the same whether they are in a management platform or not. The difference is in how you supply the configurations and ensure the networking is set up correctly. You still have the same mechanisms for configuration: injecting environment variables, mounting config files, etc. It's just that you have to have Terraform execute that work directly. May 24 at 15:19
  • I'm aware that kubernetes is providing a lot of services. But right now my website consists of three containers maximum. I'm omitting kubernetes because it would be more expensive. If my site grows and someday uses more container instances I will take a look at kubernetes. but right now I wanna keep the costs to a minimum. Droplets and the app platform are cheaper. May 24 at 18:54

1 Answer 1


Works now ... I had a typo in my NS records ...

Now I have a subdomain cloud.sommerfeld.io with correct NS records (configured at my domain hosters web ui). I set up a domain inside DigitalOcean which has the same NS records. Additionally I have a CNAME docs.cloud.sommerfeld.io pointing to the .ondigitalocean.app. This way the cloud.sommerfeld.io subdomain "controls" the name resolution for all subdomains nested under cloud.sommerfeld.io.

my config is available at https://github.com/sebastian-sommerfeld-io/infrastructure/tree/main/src/main/cloud/sommerfeld-io/configuration

Not the answer you're looking for? Browse other questions tagged or ask your own question.