Deploy golang API in Digital Ocean using docker container

How deploy golang API with docker container


Before going forward, make sure golang program work locally and ready to deploy.

  • Prepare your project with Docker configuration (Dockerfile).
  • Also need to push the project to Github and update the module structure.
  • Golang modules should structured like github.com /username/ repo-name/module and re-initialize with
go mod init /username/repo-name

Droplet

Create Docker Droplet in the DigitalOcean Cloud. In the console (cloud) clone the Github repository and build docker image.

Let’s run the container, which is similar to what do you have done in development machine.

Please see golang docker guide for more instructions

Go to your browser and try accessing API , eg: 137.184.188.21:8080 and it should work.

Don’t have a DO Account yet ?, Use this $100 and get started ?

DigitalOcean Referral Badge

Author: Manoj

Developer and a self-learner, love to work with Reactjs, Angular, Node, Python and C#.Net

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.