Introduction
Containerization is becoming more popular and widely used by developers in the software industry in recent years. Docker is still considered one of the top tools for creating containers by building Images between containerization platforms or cloud platforms. Containerizing is all about bundling up a software application/service and isolating it from the host environment such that it can run everywhere, be it an AMD or an ARM. Docker Cloud hosting has made it simple to bundle and share containers.
There will be situations where one wants to host and run these containers online in the cloud. For example, containerizing a webpage app and running in the cloud, such that it can be shared and visible to everyone. Many cloud providers allow you to build containers online for the given application and run it continuously. Alternatively, they allow the user to directly input the Image file and then create a container out of it. Let’s discusses the free platforms where one can deploy and run these Docker containers.
Learning Objectives
- Containerized applications can be shared between others freely
- Platforms allowing to host of Containerized apps at no cost
- Offerings of these platforms under free-tier
- Perks associated with these platforms
This article was published as a part of the Data Science Blogathon.
Table of Contents
End of Heroku
Hosting containerized applications on the cloud is the best way to share them with others and understand how well they can or must be scaled to make them available to millions of users with no connection lags. So many cloud platforms let you host your docker containers/applications. But most of these platforms either are not free or ask the users for their personal information, such as credit card details. Once, there used to be a platform called Heroku, which used to provide free hosting of applications in the cloud.
Heroku was very famous among all the developers for its free tier and its ease of use. But recently, Heroku removed its free tier, and now the time has come for the developers to search for its next successor. This article gives you information on four platforms that help you host containerized applications for free on the cloud without charging anything or asking for any personal information.
Zeet
Zeet is a cloud platform for deploying DevOps-operated, production-ready cloud services. Any programmer can publish code on production-grade infrastructure with Zeet, a software platform developed on top of one’s AWS or GCP, thus eliminating the need for complex management of infrastructure. It, by default, supports many programming languages like Python, Node, etc.
Zeet allows its users to deploy apps/websites using Containers, which are run in a cluster managed by Zeet themselves. The Docker Image can be directly provided to Zeet to deploy it. Zeet is compatible with a range of programming languages.
Zeet has a free plan for developers. The following are included in this free plan:
- One can deploy 3 applications by providing the Images under the free tier in Zeet
- Zeet allows the user to deploy the container in one area
- Zeet allows the user to deploy the container to either AWS/GCP/DO
- The platform provides scalable architecture and serverless functions
- The free tier provides up to 500MB of RAM
The following are its disadvantages/limitations:
- The app can be deployed only to one cloud region
- No retention of log and metric data
- API access is not accessible in the free tier
Zeet is been used by Mythia company as a replacement for AWS, thus saving hundreds of development hours. Fairgrounds company utilizing Zeet is trying to build an entire Metaverse and Paper company employing Zeet for checkout solution.
Fly.io
Fly.io is a new public cloud that make it simple to deploy/publish real-time apps close to target users, regardless of whether they might be present in the world. It is based on bare-metal servers that operate in data centers all over the world. Fly.io’s main motto is to deliver apps to end users with high availability and low-latency.
Fly.io doesn’t have anything like a free plan or free tier when it comes to their pricing section, but they allow the users to provide enough resources to run small full-stack websites/applications for free. One can host Containers on this website.
Fly.io takes in the application and its Dockerfile, which the user wants to host, then based on the Dockerfile, it builds the image and then hosts the following Container. The user can provide the pre-built Docker Image if it already exists. The free tier includes the following:
- The developer can create up to 3 shared-cpu-1x VM instances.
- All the launched VM Instances come with a 256MB RAM.
- A 3 GB disk space, i.e., persistence volume, is provided and shared between all apps.
- Allows up to 160GB of outbound data transfer.
The free tier of fly.io includes the following limitations/disadvantages:
- It provides the least amount of RAM compared to all the platforms in this article.
- The outbound data transfer varies from region to region.
- Only the first 10 single hostname certificates are free.
Many websites like reactrouter.com, kentcdodds.com, unpkg.com, and aiven.io leverage fly.io to host their websites so that their websites will be highly available to all users around the globe.
Before working with fly.io, one needs to install their command line tool called flyctl in the host operating system, and it can be done as follows:
# Installing flyctl in windows
$ powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"
# Installing flyctl in Linux
$ curl -L https://fly.io/install.sh | sh
# Installing flyctl in Mac
$ brew install flyctl
Render
Render is a fully managed seamless cloud platform that can be used to run the given app or website, providing a free TLS certificate, private network, and global CDN. It provides a variety of features, like managed databases, one-click deployments, automated scaling, and an easy-to-use UI. Provides easy integration with development tools like Docker and GitHub. Render provides native support for hosting containerized apps and services at scale.
Render has a free tier plan, which is a free tier plan, which can then be upgraded by increasing and complex computations. The free tier plan includes:
- Free 100GB egress bandwidth
- A shared CPU with 512MB RAM
- Users can run their application for free for 500hrs that renews monthly
- Render has support for auto CD(Continuous Deployment) from Git
- Custom domains with TLS for static websites
- Free 750hrs runtime that renews monthly for all the web services
- Free Postgres database
- Static websites have support for DDoS Protection, HTTP/2 out of the box
Disadvantages/limitations with respect to using Render include:
- SSH access to the web services is not supported in the free plan
- The PostgreSQL database expires after 90 days
- Web Services may restart at any time
- No free instances for Private Services
- Free Redis instances can be restarted at any time
Companies like Indie Hackers, Pete for America, Zelos, etc. have chosen Render over AWS for its simplicity which eliminated a lot of infrastructure complexity and helped them with automatic builds and zero downtime deployment.
Railway
The railway is a cloud-based deployment platform enabling users to publish and host applications in the cloud. The railway takes care of managing these servers, and databases, thus taking care of the infrastructure. It supports various languages, including Python, Next.js, Node, and many others.
One of its key features is its support for Docker. During the build process, the Railway app looks for a Dockerfile, so it can build an Image for the application based on its config and run the following Container in the cloud.
The railway comes with a free-tier plan, which includes the following:
- A 512 MB RAM and a shared CPU/container
- 1GB disk space is shared between the services created
- $5 credit and 500 hours of usage that gets renewed monthly
- Upto 100GB data transfer that gets renewed monthly
Disadvantages/limitations associated with this cloud platform include:
- Unlimited execution time is not provided in the free tier
- Shared projects are not supported in the individual plan
- Least disk space, i.e., 1GB, among the above platforms
Railway is employed by different companies like Atmos, which deals with real estate home customization, and Zora, a company related to NFTs. Fion Tech provides Machine Learning models for fire prediction, Operand, and many more.
Deploying a Flask Application
Let’s try deploying a simple Flask application to one of the platforms above. Here will deploy it to the Render platform. Let’s look at the sample code as well as the Dockerfile.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello Flask App'
if __name__ == "__main__":
app.run(debug=True)
The above code will start a flask server and display the message “Hello Flask App.” Below is the Dockerfile, which will help build an Image for the simple Flask app. Upload both of these files to a GitHub Repository.
FROM python:3.10-slim
WORKDIR /flask_app
COPY . .
RUN pip install -r requirements.txt
ENV FLASK_DEBUG=1
EXPOSE 5000
CMD ["flask","run","--host=0.0.0.0"]
- The first thing we must do now is signup to Render using your GitHub account.
- To host a Flask application, click the New Web Services tab.
- Now in the Public Git repository, add the link to your git repository that contains the flask app and the Dockerfile. After pasting it, click the Continue button. Following this, another page will appear.
- We will name our web service as simple-flask-app; the region and the branch come by default. As we are providing a Dockerfile to build an Image for our flask app. Hence, the Runtime is populated as Docker by default. Now scroll down and press the Create Web Service button to create this new service.
- Now Render will start building our simple flask application. It first searches for a Dockerfile, based on the Dockerfile, Render will create and build an Image based on the Dockerfile and then deploy it in the Renders Server. The link for the website is below the simple-flask app. Opening the link, we get to see the following.
Thus, the app is working perfectly. This way, one can create an application, then create a respective Dockerfile, which Render uses to build an Image out of it and run it on the cloud.
Conclusion
Creating an application is one task, and deploying that on the cloud as a container is another. Most of the cloud platforms do not support Docker/containerization. They don’t usually have free tier/plans, even if they support them. Cloud services like AWS/GCP do allow you to deploy these Containers but ask the user to enter their credit card details. So this article focuses on those websites/cloud services which not only support containerization but at the same time allow the user to host them for free without providing the credit card and personal information.
Some of the key takeaways from this article include the following:
- Fly.io is the best option if one wants applications to run as edge applications, i.e., closer to the end users
- At Zeet, the user can directly search for the Docker Image in the Docker Hub and deploy it.At
- Render, by default, comes with many security features, even in the free tier plan, with zero downtime deployments.
- Railway provides the user with a free $5 credit and comes with a good UI
The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.