Author: Zaher

What I have learned about Docker in the past few days

In the past few days, I was only reading about Docker, trying to understand it more and more, see how can I use it and how can I implement it in my workflow, and yet still need a lot to learn.

In my learning journey I depends on reading articles (a lot of articles), checking Docker documentation, watching online courses or even youtube videos, and trust me not all of them is worth the time I spend because either they are old or does not cover the situation am trying to achieve in my head. And am not saying they are bad, but everyone knows that Docker release cycle is fast, and with each new version they introduce a big breaking features which will not work with the older versions, so if you dont follow up fast you will lose the track and thats also apply to any article you read, if its talking about version 1.11 mean while you are working with 1.12, you may get lucky and you find the solution for the issue you are facing.

Now enough with this long talk, which is debatable by the way, lets focus about what I have learned in the past few days and how I got what I want fast.

Basically I wanted to have a small API + Database images, based on Docker like this

Continue reading

Filed under: docker, Linux, MySQL, nodejs, Other

How to remotely debug your nodejs app using PHPStorm

There are many ways to do that, but the simplest one is to do a small tunnel to your vagrant so you can connect to it as if you are connecting to local host.

so am going to use a script I found in gist ( and yes am lazy to write it every time), so all you have to do is download it and use it as the replacement to your vagrant ssh command .

Thanks to the author.

Continue reading

Filed under: Code

Configure your MySQL/Mariadb server to accept local connections

So lets say that you have created a Database server, and you wanted to accept only connections from other servers using the internal/private IP, to be honest I found that the easy way is to do that via iptables, am not going to talk about how to save your iptables as I will assume that you know how to do so, if you dont search using google.com

Lets assume that your private ip is 10.2.10.2 and your public ip is 192.168.2.10 so now you will have to execute the following commands :

Continue reading

Filed under: Linux, MySQL

Run your docker images in order

One of the many things that I found annoying in Docker (when you use docker-compose) is that you have no control over the order which the images is going to be up and running, in the documentation they have pointed out to three ways, am not going to cover them all, am just going to cover my experience with dockerize and how I used it to make sure that the database is up and running before I run the next image.

PS: please note that my way is not the best way, but it worked for me, and you should invest more time knowing and familiarize yourself with dockerize.

  1. Make sure that you install dockerize within the image which should be waiting for other images to finish
  2. Make sure that your image does not have any service that run as daemon ( In my case it was NGINX )
  3. Make sure that your entrypoint should look like :
  4. You will need to replace  tcp://database:5432 with the service and the port that you are waiting for, lets say for example tcp://nginx where we need to make sure that nginx is up and running on the default port 80.
  5. You will need to replace kong start with the service that you want to run, in my case it was Kong server

You can look at this github repo where I created a small docker repo to run Kong and Postgresql out of the box

Filed under: docker, Linux, Nginx, Other