Docker Exec Is Your Boss

Version 1.3 of Docker have introduced a long awaited feature which is docker exec that allowed user to interact with the process inside the container.

docker exec my-lamp cat /var/log/messages

User not only can peek inside the container but actually can enter into container without having additional setup such as nsenter or others. By spawning a bash program and stream back terminal to client.

docker exec -it my-lamp /bin/bash

The flag -i will keep the STDIN open thus allowing Bash program to read an input from client.

Simplify boot2docker Configuration on OSX

After installing Boot2Docker using installer tools, run below post installation command.

docker run --rm -v ~/:/target nematix/boot2docker-tool && source ~/.profile

It will automatically configure docker and boot2docker to run along with the extra features.

You can use docker-enter straight from your terminal without using ssh into boot2docker host.

docker-enter web

Additional info can be access from here Github

Add Boot2Docker Port Forward on Localhost

To have you boot2docker running container service accessible on your “localhost” or host computer, following command can be use. The command line specifically modify the boot2docker virtual machine, to add the port forward configuration to the NAT interface.

VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,0.0.0.0,8000,,8000"

The IP address of 0.0.0.0 is mean to listen on all IP of you host computer, you can also replace it with IP ‘127.0.0,0’ to make sure its only available on local loop-back adapter.

The tcp-port8000 is only a name assigned to identify the port-forward configuration and you can use others name as well such as port8000-to-8000-tcp

Cloning MySQL Including Data

Sometime we might required to create a clone of existing MySQL table for maintenance purpose or testing an experimental query. We only need 2 query to do this.

CREATE TABLE user_clone LIKE user;
INSERT user_clone SELECT * FROM user;

The first line will create a clone of source table including its index and the second line will copy all data from existing one.

Release of node-phonenumber 0.1.2 Are Available Through NPM

Release 0.1.2 have been available by today (11 July 2014) through NPM package or you can clone from my GitHub repository.

Basically nothing was change on the base-code, the true purpose of this release is to add the Apache 2.0 License attribute to the readme file to reflect the original libphonenumber licensing attribute.

Thanks to Lion Vollnhals on making remark on this issue.