devops Technology

DockerFile properties


On building a docker image you may want to have some variables (you can also have them in docker-compose)

you can define ARG in docker file (you can also set default value for them in docker file)

for example :

# in docker file
ARG some_variable_name = xxxx
ARG uid

#on building image : 
$ docker build --build-arg some_variable_name=a_value


ENV variables are also available during the build, as soon as you introduce them with an ENV instruction. However, unlike ARG, they are also accessible by containers started from the final image. ENV values can be overridden when starting a container, more on that below.

# no default value
ENV hey
# a default value
ENV foo /bar
# or ENV foo=/bar

# ENV values can be used during the build
ADD . $foo
# or ADD . ${foo}
# translates to: ADD . /bar

on running docker : 
$ docker run -e "env_var_name=another_value" alpine env


for example :

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    zip \

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd


COPY and ADD are both Dockerfile instructions that serve a similar purpose. They let you copy files from a specific location into a Docker image.


ADD  does that same but in addition, it also supports 2 other sources. 

  1. A URL instead of a local file/directory.
  2. Extract tar from the source directory into the destination.


COPY takes in a source and destination. It only lets you copy in a local or directory from your host (the machine-building the Docker image) into the Docker image itself.

for example :

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer


for example:

# Set working directory
WORKDIR /var/www


for example:

USER $user
devops Technology

Install docker on server

apt update

sudo apt install

#or : 

sudo snap install docker

docker --version

Install docker compose :

 sudo apt-get install docker-compose-plugin
devops Linux Technology

How to run our own Smart DNS to bypass geo restrictions – let’s run something like

The article in the link below helps in this way.

Check it out.

devops Technology

Install PHPMyAdmin on ubuntu

devops Linux Technology

Apache configuration manual

How to install apache on ubuntu:

let’s write a more friendly than an official apache document :

it’s simple, just follow steps below (Debian bases distributes):

  1. go to path : /etc/apache2/sites-available/
cd /etc/apache2/sites-available/

2. make a copy of the default configuration file (000-default.conf).

for every domain or subdomain that is assigned to this server IP address you need to make a copy of the default file and edit it as I explained in continue:

sudo cp 000-default.conf

3 . open the file that you created :

sudo nano

change documentRoot to the path you want to load you project

and change serverName to URL that is pointing to this file

4 . save and exit

4.5 . test your changes and be sure that your changes wont make down all apache sites :

sudo apachectl configtest

5 . now you need to add it to sites-enabled

for this you need to execute the command below :

sudo a2ensite

6 . important part is to disable the default file :

sudo a2dissite 000-default.conf

7. now you need to reset or reload apache :

service apache2 reload

Reference :
devops Linux Shell Technology

Linux Vim commands

quit of editor without saving
devops Shell

Linux Crucial Commands – Part 1

To restart your machine :
sudo reboot
To see a list of files and folders in Directory simple:
To see a list of files and folders in Directory with complete detail as list :
ls -la
To see a list of files and folders in Directory with complete detail as list :
ls -la
Best practice devops Programming Technology Web Development

Implement Rest APIs more efficient

Most web applications are implemented based on Rest Full APIs and as I researched huge part of them are not implemented based on best practices and clean code principles, so I decided to collect some points in a couple of posts to help make them more efficient APIs and Applications.

Let’s Look at other kinds of APIs

you can easily research and find out more about all of these kine of API design methodologies but here I’m going to just collect best part of them to create a document to implement Rest API in best practice.


the best part of graphql is that you can design your API for the front end to just get whatever need, not more.

it can bring us better speed because less amount of packets is transferring over the network.



devops Technology

What is Docker?

This article is for you if you …

If you are a developer and you are going to start working with docker, and you already don’t know even the concepts of Docker, this article series is for you.

It was a little confusing for me when I started working with docker, so I decided to publish some articles for bits of help who are beginners to Docker or who want to review the concepts.

Overview of docker

Docker allows users to build independent and isolated development environments in the computer and run their software in a way that we call Container. For example, suppose you need a project with php8.1, but you only have php7.4 on your system(you need the php7.4 version to develop other projects).

In this use case, you can build a docker image that contains your PHP suitable version and your database and other environments and run it as a container by the side of another project in an isolated environment.

Another Docker use case

You are running a Linux environment with different PHP, database, composer, node.js, npm, and…

And your teammate is working on mac os with a completely different environment .

What is the solution?

How can you work on the same project simultaneously in a different environment?

How to deploy a project if the server can’t provide project requirements based on our development environment?

  • docker can solve this problem by build isolated environments in the server and provide exactly requirements of peject in the isolated space.

download and install docker :