(Update 26/11/13) Docker 0.6.5 has a breaking change with ports. It does not provide a port number when you run sudo docker port $CONTAINER_ID 22 anymore. You can assign the port you expose when you do the docker run command as shown below.
Docker-desktop needs a few tweaks to get running on OSX. I thought the instructions were inaccurate but the Roberto via quick emails figured out what I was doing wrong.
Install a version of Xquartz to allow viewing of X11 onto your mac ??
# version 2.75 works with mavericks.
Install version 0.9.0 of xpra.
This is a version that will work with version 0.3.11 of xpra. 0.3.11 is the version installed on ubuntu 12.10 when you create the docker-desktop.
Install 0.9.0 as your Xpra osx client. You can use earlier versions but the versions 0.10.x and above have issues with colour pixels not working and you get a white screen.
Start of Docker install instructions:
- install vagrant if you do not have it already http://docs.docker.io/en/latest/installation/vagrant/
- Clone the docker project from git hub
git clone https://github.com/dotcloud/docker.git
Allow access to the Vagrant node from you Mac via ssh.
By Default a vagrant node is created with NAT networking. You can ssh via vagrant but you cannot ssh off the regular command line.
You have to edit the Vagrantfile that comes with docker before you vagrant up. You can choose either bridged or hostonly. I went with hostonly as it had a consistent ip address each time you started it. Here is the section of my vagrant that sets up the networking. You can set up either hostonly or bridged
FILE:Vagrant::Config.run do |config| # Setup virtual machine box. This VM configuration code is always executed. config.vm.box = BOX_NAME config.vm.box_url = BOX_URI # Use uncomment to use bridged #config.vm.network :bridged, :bridge => "en0: Wi-Fi (AirPort)" # OR # Uncomment to use Hostonly. I found this much easier as the ip remains constant # config.vm.network :hostonly, "172.16.1.254" # pick a ip address that will remain constant
Create vagrant node.
- cd docker
- vagrant up
Install docker and docker-desktop on your vagrant ubuntu node
I modified the instructions slightly as I had some issues getting it running. I did have a nice email chain as I thought there was some instructions missing.
# get onto your image you just had vagrant create
Ssh into the vagrant image and run a few commands
# Install, you will see another warning that the package cannot be authenticated. Confirm install. Do not forget your git and docker on the Ubuntu vagrant node.
sudo apt-get install git lxc-docker
#docker build the docker-desktop instance
docker build -t vagrant/docker-desktop git://github.com/rogaha/docker-desktop.git
#on vagrant node start up the docker container
#new to 0.6.5 is the assigning a port to the exposed port in the docker file
CONTAINER_ID=$(sudo docker run -p 44:22 -d vagrant/docker-desktop)
#get password for container. I like to stick it in a file as I end up forgetting it too frequently.
echo $(sudo docker logs $CONTAINER_ID | sed -n 1p)
#get ipaddress for box It will be similar to 172.17.0.2
ifconfig | grep “inet addr:”
# start up the docker-desktop with a slightly larger screen so Xpra on the mac does attach.
ssh email@example.com ./docker-desktop -s 1000×800 -d 10
Setup the docker-desktop instance to display firefox
#ssh onto the box to setup the display to show firefox through display 10
# setup display to show firefox
DISPLAY=:10 firefox &
From your terminal on the mac host NOT in vagrant vm attach to the docker-desktop
# We know the port to use because we assigned the port to be 44 in the run command.
# 172.16.1.254 is the ip address I assigned in the Vagrantfile.
/Applications/Xpra.app/Contents/Helpers/xpra –ssh=”ssh -p 44″ attach ssh:firstname.lastname@example.org:10
And you should now see xpra start up as a window and show you firefox.
Original instructions OSX docker install
Thanks again to Roberto G. Hashioka for creating this.