How to Dockerize an Existing Sinatra Application

How to Dockerize an Existing Sinatra Application

What is Sinatra? It's a domain-specific language to create web-based applications using Ruby. We can use Sinatra to create a web application faster with less ...

What is Sinatra? It’s a domain-specific language to create web-based applications using Ruby. We can use Sinatra to create a web application faster with less effort.

A Dockerized application boosts development speed by minimizing tasks like environment management, which saves time and effort. From this post, you’ll learn how to Dockerize an existing Sinatra application.

Setup

First, we need need to install Docker and download a git repository from GitHub. For this setup, I’m using macOS.

Now, we will create a Docker image that contains Ruby. Let’s break down the individual ingredients of the Dockerfile file.

The From instruction is used to define the parent image. Here we are using the pre-built official image of Ruby from Docker Hub. We can add everything from the current folder into a directory in the image called Sinatra-Docker *by using the ADD instruction. The WORKDIR instruction will set the working directory to *Sinatra-Docker. After that, we are exposing port 4567 for our container using the EXPOSE instruction. By default, Sinatra runs on port 4567. Finally, the CMD instruction is used to run a command when a container starts, and here we are opening the bash shell.

Now, we will create a Docker compose file to run a Docker container using the Docker image we just created. Let’s break down the individual ingredients of the docker-compose.yml file.

docker

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Docker Architecture Overview & Docker Components [For Beginners]

Docker Architecture Overview & Docker Components. This ultimate guide revolves around the underlying technologies used by Docker Containers to provide effective containerisation services to its users. It explains the entire Docker architecture and its components using intuitive diagrams.

Docker Tutorial for Beginners 8 - Build and Run C++ Applications in a Docker Container

Welcome to this on Docker Tutorial for Beginners. In this video provides an Introduction on C++ development with Docker containers. So we will see How to ship C++ Programs in Docker.

Docker: Installing Docker and Understanding basic docker commands

“Docker: Understanding Docker Architecture and Components”, The First thing we are going to do is to run the “docker run hello-world” command. This command tries to find the “hello-world” image locally and if not found, it then downloads an image from the docker hub and runs the container out of this image.

WordPress in Docker. Part 1: Dockerization

This entry-level guide will tell you why and how to Dockerize your WordPress projects.