Docker is an open-source engine that automates
the deployment of applications as highly portable, self-sufficient
These containers are both hardware and platform agnostic, meaning that
they can run anywhere - from your laptop to the largest cloud server and
everything in between.
On top of this, they don’t require that you use a particular language,
framework or packaging system. That makes them great building blocks for
deploying and scaling web apps, databases and backend services without
depending on a particular stack or provider.
Deploying Docker on different cloud providers varies slightly, and
Joyent is no exception. This post outlines how to go about deploying Docker on Joyent servers.
Let’s get started
We firstly need to provide read, write and execute access to all users
/tmp directory, but with the sticky bit that allows only the
directories’ owner or the superuser to rename or delete files.
$ chmod 01777 /tmp
To avoid running into storage capacity problems down the line, we need
/data and mount a bind between
the new and original directories.
$ mv /var /data/ $ mkdir /var $ mount --bind /data/var /var $ mv /home /data/ $ mkdir /home $ mount --bind /data/home /home $ mv /opt /data/ $ mkdir /opt $ mount --bind /data/opt /opt
Next we need to add the following binds to the
/etc/fstab file, which
contains information of where your partitions and storage devices should
be mounted and how. This allows our binds to persist across reboots.
$ cat << EOL >> /etc/fstab /data/var /var none bind 0 0 /data/opt /opt none bind 0 0 /data/home /home none bind 0 0 EOL
The default kernel installed on Joyent servers (Linux
3.8.6-joyent-ubuntu-12-opt) does not have an AUFS module. We will
therefore install a new kernel that comes with AUFS built in.
$ sudo apt-get update $ sudo apt-get install linux-image-generic-lts-raring
To boot this new kernel, we need to set
GRUB_DEFAULT to 2 in
/etc/default/grub, and run:
$ update-grub $ sudo reboot
Next we need to load the aufs module to the kernel with the following
$ modprobe aufs $ sudo reboot
Docker is available as a Ubuntu Personal Package Archive and is hosted
on launchpad, which makes installing Docker on Ubuntu straightforward.
Add the PPA sources to your apt sources list
$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:dotcloud/lxc-docker
Update your sources
$ sudo apt-get update
Install, you will se another warning that the package cannot be
authenticated. Confirm install.
$ sudo apt-get install lxc-docker
To verify that it worked, download the base ‘ubuntu’ container and run
bash inside it while setting up an interactive shell. Type
$ docker run -i -t ubuntu /bin/bash
Type docker to see available commands, and see
https://docker.readthedocs.org/en/docs/commandline/cli/ to learn more about them.
Next you can move onto the Hello World example here