Getting started with Docker

docker201511

If you are in software development and web development, you are likely to have come across Docker as well as Vagrant. These are the two important Virtualisation tools that you will use for your development/production workflows.

For MacOSX you can install via Dockertoolbox: http://docs.docker.com/mac/started/ . The Mac version is quite straightforward; either you can download the docker toolbox image (which consists of docker-compose, docker, docker-machine) or install it via brew if you have homebrew installed.

$brew cask install docker-toolbox

For Linux Ubuntu, you can install via apt-get. Note that the version in apt-get repository is quite dated. The recommended Ubuntu version is 14.04 Trusty (LTS – Long Term Support). Full detailed instructions can be found: https://docs.docker.com/engine/installation/ubuntulinux/ .

The summarise version as follows:

  • Open up terminal (if you are running desktop version); and run the follow statement to add the gpg key:

$ sudo apt-key adv –keyserver hkp://p80.pool.sks-keyservers.net:80 –recv-keys 58118E89F3A912897C070ADBF76221572C52609D

  • Then edit the repo source list:

$ touch /etc/apt/sources.list.d/docker.list

$ nano /etc/apt/sources.list.d/docker.list

  • Add the following line if it does not exists:

deb https://apt.dockerproject.org/repo ubuntu-trusty main

Now save the file and close. Next run the following:

$ apt-get update

$ apt-get purge lxc-docker

$ sudo apt-get update

$ sudo apt-get install linux-image-extra-$(uname -r)

$ sudo apt-get install linux-image-generic-lts-trusty

$ sudo reboot

The machine should be rebooting now.

$ sudo apt-get install docker-engine

$ sudo service docker start

$ sudo docker run hello-world

At this point, there is a tool docker-compose which is not installed by default. You can build from github: https://github.com/docker/compose or i recommend from python.

Now to setup docker-compose.

$ python -V # this should print out python version number

$ sudo apt-get install python-setuptools

$ sudo apt-get install pip

$ sudo pip install docker-compose

Why should we install docker-compose? If you look at some docker projects, they have a docker compose file. This will allow you to pretty much start the service via:

$ sudo docker-compose up

Pretty nifty, as this will run the application based on how the author intended. If you have a look at the docker-compose yml file, it is pretty much self explanatory.

Okay, now to docker. Two key concepts of docker are containers and images. Using Jenkins (a build management tool) as an example. We can download the image Jenkins using the following command:

$ sudo docker pull jenkins

To run it:

$ sudo docker run -d -p 8080:8080 –name myjenkins jenkins

wow. so what is that? basically, -d flag is running it in detached mod (running in background), -p is the forwarding port 8080(to) : 8080(from), –name as the custom running container name and finally jenkins is the images to look for.

If you do the following, you can now see the running processes.

$ sudo docker ps

If you add in -a, you can see all inactive processes as well.

$ sudo docker ps -a

If you wish to delete a container, you can either use the –name you declared or the container ID.

$ sudo docker rm my jenkins

Finally, you can backup running containers via:

$ sudo docker export myjenkins > jenkins-backup.tar

You can also restore containers. But I will leave this up to you to do a bit of research homework.


Recent Posts
Improving terminal load times · Extracting OVF from VMware ESXI 6.0 · Installing LMDE 2 Betsy · SSL Certificates and Encryption · Machine Learning with Spark · Installing Lubuntu in Virtualbox · Getting started with Docker · Ubuntu upgrade limited boot space · Top 10 Browsers Overview · Taovilla Oracle app beta built using meteorjs · Setting up Debian on VirtualBox · The HomeBrew doctor · Caffeine icon for ubuntu / lubuntu · Updating wordpress without FTP · Updating wordpress without FTP · Preinstalled Languages on mainstream OS · Reminisce of Xcom · Java install on Ubuntu · Display image as ASCII art · VirtualBox Resizing Lubuntu Guest Linux · Introducing Samurai · Macbook Pro Key mapping for Lubuntu · Common Apache Nginx commands · Refreshing Git versioned files · Basic Environments for Jira · Converting a hg mercurial to git repository · Long term domain name costs comparison · SVG Graphing · 2 ways to Php install on mac · Introducing Samurai and Installing Meteorjs to own server · Improving the speed of Linux Mint · SVG graphics with Javascript · FTP Clients for Mac OS X · Windows Apps on Mac · Programming Languages Compared · Hackers Natural Cure · Publishing on Ebooks · Editors such as SublimeText2 · Good Coding Practice · LMDE Linux Mint Debian Edition · Heroku Webapp · Hadoop Single node 32bit on 12.10 Mint XFCE · Tracing User Behaviour FRUBO · Installing Nginx on MacOSX · Installing Ruby on MacOS X · Turn off annoying compress outlook message · HTML5 Apps on Cordova PhoneGap with MacOSX · Choosing and using Latex · Reviewing Javascript World · Draw up an Ubuntu Server Environment · Draw up a Lightweight Mail Server · Draw up a Web Database · Php CMS and Frameworks · Drawing up a Web Service · Draw up a Virtual Cloud Server · Unlocking and Flashing your ZTE Blade · Pip error in Python with Homebrew · HomeBrew for OSX · Windows and Linux Desktop Security · TexMaker with Glossary on Mac · Quick way to OpenStack on Lubuntu · Ancient IT Dictionary · TeaTime for Basic Python · CVs and Jobhunting · Chinese Input on Linux Ubuntu · Research in Computer Science · Reviewing Applications on My Mac · Reviewing Applications on My Windows · Installing Windows XP · Installing wireless on Linux Ubuntu or Mint · Restoring an Amazon EC2 Backup · Mac Update PASV problem · Reviewing Green Computing · Consuming the Cloud Storage Space · Using Cherokee and WordPress Whine · Disabling Lubuntu Screensaver · Installing Lubuntu from USB drive · Searching for a Micro Mini CMS · ReStructuredText in Python · Rackspacecloud Vs Amazon · Hacking your old PSP · Attending Atlanta 55th MMM Conference · Smart devices for everyday use · Creative Programmers · Linux Settings · Embarking on Further Education · Machine Learning · Mac Tips – Viewing hidden files on desktop · Creating PDF files for free · Online Media for All · C# ASP Settings · SVN Git and Mercurial Versioning · Getting the last inserted id using datasets · Think Lucky and be Happy · AngieGallery Design · AceTravel Design · Letter to Mum · Prison Vs Work · Irish Daughter · Are you a carrot, an egg or a coffee bean? · Home Media Entertainment Setup · Collection of Interesting sites · Studying in London · Great Oriental eats in London · CMS Joomla, WordPress, Drupal compared ·

© 2017 · MirageGlobe · using zenifywordpress theme by www.dracoturtur.com ·
  · RSS Feed