Docker - Unable to push image to private registry

From comments of the accepted answer, it looks like the solution does not works for all. The following solution works for me.

Create systemd conf override file for Docker

sudo mkdir /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/docker.conf
sudo vi /etc/systemd/system/docker.service.d/docker.conf

Add these following line and save it

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS
EnvironmentFile=-/etc/default/docker

Edit /etc/default/docker

sudo vi /etc/default/docker

Add the following line and save it. Replace localhost:5000 with your registry domain name and port

DOCKER_OPTS="--insecure-registry localhost:5000"

Restart docker daemon

Reload overriden configuration and restart docker as follows

sudo systemctl daemon-reload
sudo systemctl restart docker 

stop the service.

sudo service docker stop

restart service with --insecure-registry arguments:

/usr/bin/docker -d --insecure-registry localhost:5000

or edit /etc/default/docker file and add the following line:

DOCKER_OPTS="--insecure-registry localhost:5000"