DEV Community

Sumit Jha
Sumit Jha

Posted on

Deploying Your First Web App

Launching your app in a Dockerized way is the first step towards becoming a DevOps Engineer.

This step might look simple, but you could face issues with that. As a DevOps engineer, our main goal is to rectify the issues and make our app live for the world.

In this article, I will provide you with step-by-step guide on hosting your simple app in a dockerized way. We will also rectify all the issues that you might counter into.

Deploying Your App In AWS

Deploying your app is an 3 step formula:-

You have your app. Then do the following things:-

Write Docker File

Create Image From Docker File

Containers

Deploy your app. This look very simple.

However, let's see the process

Installing Docker In Your Linux System

First of all, we have to install Docker in our local system. Here is the step to install Docker in the system:-

Update The System

sudo apt update

Install Docker

sudo apt install -y docker.io

Verify if Docker is installed or not

sudo systemctl status docker

In most of the cases, Docker should install. However, this issue might come up.

Let's remove the error.

docker buildx version

We will see something like

github.com/docker/buildx v0.x.x

This means the system has been resolved.

Verify by running the command

sudo systemctl status docker

This should look like this:-

If we can see

Active: active(running)

Then this is active. This means our Docker is up and running.

However I would make 1 small change.

Whenever I start the system, Docker should start automatically.

sudo systemctl enable docker

Adding User To Docker Group

Run:

sudo usermod -aG docker $USER

Then refresh the session:

newgrp docker

Writing a Simple Docker File

This is the most important step. If done properly, you will be head of many DevOps engineers.

Here is the file that I am hosting - Check Here

Build The Docker File

docker build -t motivationalquotes .

motivationalquotes - This is my app name

Check if the image is created

docker images

Running An Images

docker run -d --name quotes.app -p 8000:8000 motivational-quotes

It will give an id

Check all the running Docker containers

docker ps

Top comments (0)