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

Run node apps on port 80 without Root permissions

Most of us run the node apps under the root user, so last time I talked about using IPTables to do some tricks which will route the requests from port 80 to port 8080.

Today I was able to do so without IPTables , and you can run this command with SUDO to give node the ability to use the port 80 :

I used it on Ubuntu 16.04 and it worked like a charm.

PS: I noticed that the command was not clear so I need to put it in an image


Filed under: Code, Linux

How to bind Docker image to specific IP on MAC

PS: this is an experimental idea so it might not work for you.

I’ll try to make short here, so basically you will have to pass the IP with the expose port while you execute docker run for example something like

Now the question why do I need to do something like that since at the end docker will be bind to localhost and more specific to , and to be honest this is just a simple try for me to imitate the ability to have two (or more) vagrant boxes running on the same machine and both has the port 80 exposed to the host.

So normally you will only have one image cause you cant have two images on the same port (or at least this is what I have in my mind right now), so the command above will help, now when you try it you will face a small problem, which is that the IP should be the same as your host IP and you cant have both images have the same IP, so it wont work and we have gain nothing, lets talk about how vagrant/virtualbox work, they do a small trick where virtualbox will create a virtual network adapter and configure it to have the IP which you specified in Vagrantfile, so I guess we will have to do the same Creating a new virtual network adapter.

Continue reading

Filed under: Code, docker, Linux, Nginx, PHP

How to configure PHPStorm to work with native Docker on Windows

Some how most of what we have talked about in the previous article about “How to configure PHPStorm to work with native Docker for mac“, so mostly you will have to do the same except that you dont need to install socat but you will need to make sure that :

1- you have enabled the Disk Share on the drive that you are using like for example:


2- you will need to make sure that you are using the following address : tcp://localhost:2375


and everything else will be the same as the old post.


Happy Coding Everyone


Filed under: Code, PHP

When to ask for Investments

First of all and before I say anything, I just want to take you in a small trip back in time where we (me and Hala) lunched our start-up Msrofi .

At that time everyone thought it was a good idea, but we forget one important things that nice ideas need money. So few years later we had to close the project and even when we tried to get investors to invest in the project ( in 2013 ) they though its not ready yet.

Now lets talk about Investors and do we really need them, In my opinion if you have a good amount of money which will let you create a stable business and valuable product then try to stay away from Investors, dont try to go to them let them come to you, and when I say a stable business I mean:

  1. Good and talented technical team.
  2. Good money income which cover some of your expenses, or lets say a stable money flow.
  3. Good plan for a steady growth.

Continue reading

Filed under: Business