migrate local docker images to a remote docker host

A. New remote host
– install docker
– setup simple configuration to let docker daemon be accessible from other machines:
Edit /etc/default/docker, and add following line

DOCKER_OPTS=”-H tcp://″

– restart docker daemon

sudo service docker restart

With systemd systems (trusty and vivid), we must add new file :
with following content:

ExecStart=/usr/bin/docker -d $DOCKER_OPTS

And then restart socker.

Now, when trying :

docker ps

we’ll got error:

Get http:///var/run/docker.sock/v1.19/containers/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

That’s because docker client try to connect to file socket by default. So, from now, we must specify which host to connect to when running docker client. Like so :

docker -H localhost:2375 ps
# or
docker -H ps
# or
simply docker -H :2375 ps

Ok, but it’s annoying to specify the host all the time !
So, the solution is to define an environment variable DOCKER_HOST:


then we can just run :

docker ps

B. Local host

We must set environment variable DOCKER_HOST like following (assume host machien ip is


C. transfer images from local docker host to remote docker host
Now, to move all local images to the new docker host, we have to make it in three steps :
1. under local machine: export images as tar files

docker -H “” save -o /tmp/myimage.tar myimage

2. transfer tar files from local machine to the remote one (with scp for example)

scp /tmp/myimage.tar user@

3. under remote machine: load images

docker load -i /tmp/myimage.tar

Hope this help

nginx as reverse proxy

I’m working on dockerizing several projects with docker-compose. And, I automated checkout from git repository and building projects,
One of maven projects inherits from parent pom the url of nexus repository. And unfortunately, nexus server was moved to a new url. This fails maven build, because it can’t download artifacts from old nexus url.

While I have no time to fix nexus url in parent pom and recompile all depending projects. And while I’m rushed to run and validate my docker-compose. I’m looking for rapid solution.

We can simply use hosts to redirect old url to the new one. But in my case, it’s not possible because the old url contains a port number.

old_url: http://oldurl.net:8080
new url: https://newurl.net

So, I use nginx as reverse proxy to solve problem:

Step1: install nginx

$ sudo apt-get install nginx

Step2: nginx configuration
create /etc/nginx/conf.d/witr.conf with following content

server {
listen 8080;
server_name oldurl.net;
location / {
proxy_pass https://newurl.net;
proxy_redirect off;

Step3: locally redirect server name
edit /etc/hosts and add new entry oldurl.net

Step4: restart nginx

service nginx restart

Finally : run my automated build. On download, maven will ask oldurl:8080. hosts will redirect to nginx. Nginx will redirect to newurl. And maven will be able to download artifacts and build will not fail.

known trouble when using aapt

You have trouble using aapt. And following error is raised : java.io.IOException: Cannot run program “/opt/Android/Sdk/build-tools/22.0.1/aapt”: error=2, No such file or directory.
You are probably using aapt which is a 32bit application under a 64bit running ubuntu.
To get it working, simply install :

sudo apt-get install lib32stdc++6 lib32z1

access to a dockerized apache from local mochine

Get ubuntu

docker pull ubuntu:vivid

Start ubuntu container

docker run -ti ubuntu:vivid /bin/bash

Install apache

root@54a954be4ca3:/# apt-get install apache2

Type CTRL+P then CTRL+Q : this will exit the shell without killing the process
Now in the local machine, check out the container name

docker ps

Save the container with its apache installed (suppose your container name is happy_pasteur)

docker commit -a “witr ” -m “install apache2” happy_pasteur witr/myapache

Stop the container

docker stop happy_pasteur

Start apache in new container “myapache” and bind ports

docker run -d -p 9999:80 witr/myapache /usr/sbin/apache2ctl -D FOREGROUND

Finally browse http://localhost:9999

VT-x is being used by another hypervisor .. Please disable the KVM

while starting my VM using vagrant, I have following error :

The guest machine entered an invalid state while waiting for it
to boot. Valid states are ‘starting, running’. The machine is in the
‘poweroff’ state. Please verify everything is configured
properly and try again.

If the provider you’re using has a GUI that comes with it,
it is often helpful to open that and watch the machine
, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you’re using VirtualBox, run vagrant up while the
VirtualBox GUI is open.

So, I edit my Vagrantfile and uncomment gui

Then I start my vm using VirtualBox. I have the following error :
VT-x is being used by another hypervisor … Please disable the KVM

what to do ?
1. see if kvm is running and is used

witr@serv:~$ lsmod | grep kvm
kvm_intel 143592 3
kvm 459835 1 kvm_intel

here kvm is used by one consumer (kvm_intel) and kvm_intel is used by 3 consumers.

2. stop kvm consumers
In my case it’s the android emulator i have launched from AndroidStudio which causes problem. I stop emulator.

3. restart vm
that’s all

extract json text

save received traffic on tcp port while the port is in use

You have to save all received traffic on a tcp port. But there was one process which already listen to that port.

=> use tcpdump :

More pretty and analysable with Wireshark,
=> use dumpcap :

clean up local repo

delete branches already deleted in remote repo

witr$ git remote prune origin

list local branches and theirs on remote : helps to see which local branch references to deleted remote branch

witr$ git branch -vv

delete branch referencing to deleted remote branch

witr$ git branch -d branch-to-delete

local clean up

witr$ git clean -dfx

target busy when umount

I have mount webdav directory /mnt/wdav (more). And, now, I want to umount it.
but i have following error:

umount: /mnt/wdav: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)

first step : find out processes using this mount

witr$ fuser -u /mnt/wdav
/mnt/wdav: 408c(witr)

second step : identify process

witr$ ps 408
408 pts/33 Ss 0:00 /opt/appli

third step : stop process

witr$ fuser -k /mnt/wdav

last step : safe umount

witr$ sudo umount /mnt/wdav