/ Blog Details
By Evan Dangol
27 Jan 2024
09
35
Docker is a powerful platform that streamlines the process of developing, packaging, and deploying applications. It utilizes containerization technology to encapsulate applications and their dependencies into lightweight, portable containers. These containers ensure consistency across different environments, making it easier for developers to work seamlessly from local development to production deployment.
Docker containers can run consistently on any system, whether it's your local machine, a testing environment, or a production server. This eliminates the infamous "it works on my machine" problem.
Containers provide a level of isolation for applications, ensuring that they don't interfere with each other. This isolation enhances security and simplifies dependency management.
Docker optimizes resource utilization by sharing the host operating system's kernel. This results in faster startup times and efficient use of system resources.
To get started with Docker, follow these basic steps:
Install Docker: Head to the official Docker website and download the Docker Desktop application suitable for your operating system.
Create a Dockerfile: Define your application's environment, dependencies, and runtime instructions in a Dockerfile. This file serves as a blueprint for building Docker images.
For Example :
- for private repo
FROM ubuntu
RUN apt update && apt install -y apache2 curl nano unzip
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=${GITHUB_TOKEN}
RUN curl -LJO "https://codeload.github.com/edangolgithub/evanhtmlprivate/zip/refs/heads/master" -H "Authorization: token $GITHUB_TOKEN" \
&& unzip -q evanhtmlprivate-master.zip -d /var/www/html/ \
&& mv /var/www/html/evanhtmlprivate-master/* /var/www/html/
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
- for public repo
FROM ubuntu
RUN apt update && apt install -y apache2 curl nano unzip
ADD https://codeload.github.com/edangolgithub/evanhtml/zip/refs/heads/master /var/www/html/code.zip
RUN cd /var/www/html/ && unzip code.zip && mv /var/www/html/evanhtml-master/* /var/www/html/
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
docker build --build-arg GITHUB_TOKEN=personal_access_token -t evanhtmlprivate -f private.dockerfile .
docker run -p8888:80 evanhtmlprivate
Enter your email to receive our latest newsletter.
Don't worry, we don't spam
Comparasion of free tier AWS, Azure and Google cloud virtual machines -by Evan Dangol
How to Access local web api from mobile device -by Evan Dangol