How to setup a Linux machine with Docker on DigitalOcean for $5

engineering Dec 28, 2018

I originally wrote this as a single post to demonstrate how I deployed an ASP.NET Core side project onto a Linux machine using Docker. It soon became a very large pos. I covered installing Nginx as well as configuring SSL on the way. So, to get things started, this will be one of the first posts on how to create a Linux machine with Docker.

Cheap hosting for ASP.NET Core

I wanted to find a cheap method of hosting for ASP.NET Core and thus discovered DigitalOcean. Theye offer a very affordable package for just $5. Yes. Just $5. No, its not slow at all. Its pretty quick!

How to create a Docker droplet

Sign up to DigitalOcean if you haven't got one already. You can use this referral to get you some free credits to get you started.

Create an account with DigitalOcean

Go ahead and create one on DigitalOcean

Create a Docker Droplet

  1. Choose a droplet type and size.
    In the one-click apps that DigitalOcean provides, select the docker image as shown below. Be sure to select the size of the droplet. I selected $5 per month.
  2. Select backups and region.
    Decide whether you wish to have backups and the region of where the droplet is located. I selected no backups and the London region.
  3. Add ssh capabilities and provide a hostname. I already had a previous ssh key generated, but if this is the first time, be sure to check out this guide on how to connect to your droplet, web-digitalocean-select-droplet-3
  4. When you're happy, click "Create". DigitalOcean will now go ahead and provsion the droplet, which will take only a few minutes.

Connecting to the Droplet

Once the droplet has been created, you can inspect it within the DigitalOcean dashboard and you should see something like this:

  1. Obtain the ip address as highlighted in yellow above. I have masked the last few digits for privacy reasons.
  2. SSH into the droplet using the public ip address to ensure that you can connect succesfully. DigitalOcean provides a very useful guide on how to connect to a droplet with ssh.
  3. If all goes well, you should see something like this:

Great, now that we have access to Linux machine with Docker installed, in the next post, I how I deployed a simple ASP.NET Core project using Docker onto this DigitalOcean droplet.