Tech

Using Docker in Mac OSX with VMWare Fusion and docker-machine

Although Docker uses Linux kernel features, it is possible to run docker containers in Mac OSX by installing a linux virtual machine and running the docker containers inside the virtual machine.

Create virtual machine called osxdocker:

docker-machine create --driver vmwarefusion osxdocker --vmwarefusion-memory-size=2048

Set environment variables to let the docker command line program connect to boot2docker

eval `docker-machine env osxdocker`

Run docker commands

How to catch up vmware clock to accurate time after a virtual machine pause/un-pause

When you pause a VMWare Fusion virtual machine on a Mac OSX host and resume it after a long time, your system clock will sometimes be behind. ntpd won't catch the clock up if it's too far behind. One manual solution is to run ntpdate in the guest operating system once the virtual machine unpauses:

sudo ntpdate pool.ntp.org

Another approach which I am currently trying, is to set your clocksource to use acpi_pm instead of tsc. You can check which clocksources you have available with:

Installing Ubuntu onto a NFS mount

It is possible to install Ubuntu onto a NFS networked filesystem directory, which you might want to do in order to boot that copy of Ubuntu over the network on a diskless thin client computer.

Set up the base filesystem:

Booting Ubuntu from a network filesystem

It is possible to boot Ubuntu over the network on a computer with no local hard drive. You need:

  • A DHCP server that supports PXE
  • A TFTP server with enough space to host the kernel binary
  • An NFS server with enough space to host the root filesystem

The steps involved are:

Building debian .deb packages from source

These are my notes on building debian packages from source.

The steps in preparing a binary debian packages are roughly:

  1. Start with the upstream source code (e.g. .tar.gz)
  2. Unpack it
  3. Add a debian/ subdirectory inside of the unpacked source code
  4. Create a debian prepared source code (.orig.tar.gz) containing the debian/ directory
  5. Create source package (.dsc)
  6. Create binary package (.deb)

Steps without using ubuntu bzr:

LXC command cheat sheet / quick reference

lxc-create -t download -n mycontainer -- -d ubuntu -r trusty -a amd64
Create an (unstarted) container. Other architectures include: i386
lxc-start -n mycontainer -d
Boot up a container -- excluding -d will also run lxc-console
lxc-attach -n mycontainer
Execute a root shell inside of a started container
lxc-console -n mycontainer
Open a login screen inside of a started container
lxc-stop -n mycontainer
Shut down a started container

Progress Bar Project Management

To an outsider looking in, commercial software projects* should look like a well designed progress bar.

Dockerfile library

(Updated Sep 17, 2017)

I've created some scripts and Dockerfiles to build docker images. There are images for:

Ways to download a file via HTTP from the command line

Current Ubuntu distributions do not come with either wget or curl installed, but they do include Python and Perl. Here are some alternative ways to download a file and print it on stdout without wget or curl:

Shaing your home directory between Mac OSX and a VMware Fusion 7 Linux Virtual machine

First, give your virtual machine a fixed IP address.  VMWare Fusion's dhcpd server will often change the IP address assigned to your virtual machine -- even while it's still running.  While you can give the entire IP address range block access to your home directory over NFS, that can disrupt some other tools like Vagrant.

% cat /etc/exports
/Users/wtanaka 172.16.221.10 -maproot=root:wheel

Restart nfsd in Mac OS:

% sudo nfsd stop
% sudo nfsd start

Pages

Subscribe to RSS - Tech