Docker is a fast moving project enjoying a lot of popularity among developers across all branches. With this wide support the Docker ecosystem is evolving almost every day reaching from Deis as a PaaS platform, cluster management in CoreOS and Kubernets. Even Microsoft is considering Docker support for their next version of Microsoft Server. In this post I would like to demonstrate how to upgrade to a master release of Docker running on Mac OSx with Boot2Docker which comes handy when trying to keep up with the latest development or move a around a current bug already fixed in a new release. Likely the here stated notes will also be useful with other environments.
Upgrading Docker Client
Upgrading docker to a recent master version is straight forward. We first need to download the wanted docker binary. In our case we are aiming to install the current master branch which can be found here. After downloading we’ll replace the existing docker binary be linking to the downloaded one Here is how to do it:
$ mkdir ~/docker $ curl -Lo ~/docker/docker-1.8.0-dev https://master.dockerproject.org/linux/amd64/darwin/amd64/docker-1.8.0-dev $ sudo rm -f /usr/local/bin/docker $ sudo ln -s ~/docker/docker-1.8.0-dev /usr/local/bin/docker
After the above commands the client should successfully be updated. This can be verified by running docker version. When doing so you should see an output similar to this:
$ docker version Client: Version: 1.8.0-dev API version: 1.20 Go version: go1.4.2 Git commit: b49c985 Built: Fri Jun 26 09:27:55 UTC 2015 OS/Arch: darwin/386 An error occurred trying to connect: Get https://192.168.59.103:2376/v1.20/version: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103
With this output you can see that the client was successfully update to 1.8.0-dev. What this output also tells you is that the server (docker daemon) not yet has been updated correctly. We will do this next using Boot2Docker.
Upgrading Docker Server (Boot2Docker)
Updating the docker daemon is basically the same as the client as you only have to change the existing binary. Starting the docker daemon over the init script is almost the same as running docker -d. But running the docker daemon is not supported on all OS incl. OSx. Therefor most of the time the daemon is executed on VM running locally on OSx. Updating the daemon there is still the same with the exception that we have to make the changes permanent by making them resistant to restart.
$ boot2docker up $ boot2docker ssh $b2d> sudo su $b2d> curl -Lo /var/lib/boot2docker/docker-1.8.0-dev https://master.dockerproject.org/linux/amd64/docker-1.8.0-dev $ rm -f /usr/local/bin/docker $ ln -s /var/lib/boot2docker/docker-1.8.0-dev /usr/local/bin/docker $ /etc/init.d/docker stop $ /etc/init.d/docker start
This now has also updated the running docker daemon on Boot2Docker. By placing the docker binary in /var/lib/boot2docker the file will also be available after a restart. But will also the linking of packages be available as well? The answer to this is now. So take make the changes permanent after restart we will still have to do the linking. With Boot2Docker this can be achieved by placing a script inside of file named bootlocal.sh also placed under /var/lib/boot2docker. Here is what the content of this script could look like:
DOCKER_VER=1.8.0-dev sudo sh -c "rm -f /usr/local/bin/docker ; ln -s /var/lib/boot2docker/docker-${DOCKER_VER} /usr/local/bin/docker ; /etc/init.d/docker stop; sudo killall -9 docker; /etc/init.d/docker start"
After a chmod 755 /var/lib/boot2docker/bootlocal.sh restart of Boot2Docker we should see the following when running docker version form the OSx host:
$ boot2docker restart $ docker version Client: Version: 1.8.0-dev API version: 1.20 Go version: go1.4.2 Git commit: b49c985 Built: Fri Jun 26 09:27:55 UTC 2015 OS/Arch: darwin/386 Server: Version: 1.8.0-dev API version: 1.20 Go version: go1.4.2 Git commit: 7fde07e Built: Sun Jul 5 09:52:43 UTC 2015 OS/Arch: linux/amd64
We now have successfully updated our Docker installation.
Further Reading
- Docker Docs (Master Branch)
- Boot2Docker
- Docker: Up and Running (Amazon)
- Docker in Action (Manning) (Amazon)
Upgrade Docker to Master on OSx http://t.co/MOYY4uOwwM
LikeLike
Von @jonbros: Upgrade Docker to Master on OSx http://t.co/A25BwATDqm #IronBloggerMUC
LikeLike