How to make a docker machine from an old laptop

On OS X you can not run Docker natively. Instead, you must use a virtual machine. It is common to run out of memory if you run multiple virtualized docker containers, IDEs, Chrome tabs and so. Although it is possible to use cloud instance as docker machine the high latency is an issue. An alternative for that is to run Docker Machine on a spare laptop in a local network. In this post I briefly describe how I did it.

More local resources for Docker

On my OS X I have 16 GB. Sometimes it is not enough. I decided to use my old Asus laptop as a Docker Machine. Thanks to that I have additional 8 GB memory and 8 CPUs. In compare with cloud instances, the network latency negligible (due to local gigabit ethernet network).

Remote Docker Machine

First, I installed clean Ubuntu 16.04 on Asus. Then, I followed these instructions to install a Docker Engine, adjust memory, add a user to docker group and configure Docker to start on boot. It is also worth to connect to the network using an ethernet cable and set up static IP address.

Remote Docker Client

Next, I switched to my OS X. I already had the docker-toolbox installed. As it is handy to connect to the host via ssh without a password I ran ssh-copy-id mbilski@ to copy my certificate. Then, I executed the following command to create a Docker Machine using the generic driver.

docker-machine create --driver generic \
--generic-ip-address= \
--generic-ssh-user mbilski \
--generic-ssh-key ~/.ssh/id_rsa \

To load configuration for this remote machine I run eval $(docker-machine ip asus). After that I can use regular Docker commands (like docker ps or docker-compose up) and all the containers are run on the remote laptop. For more information see docker-machine-generic.


I find this a really quick and easy way provide more resources for Docker containers with minimal latency degradation. If you need more resources and have some old hardware left you can consider building a cluster using Docker Swarm.

comments powered by Disqus