Docker lightning talk

How easy stuff can be…

CI in 5 minutes

User cases (for me)
  • Installing multiple different version of packages.
  • Some programs are a pain to setup in windows.
  • If anything comes from it, the app is already packages.
Install
  • Comes with extra programs.
    • Engine - docker
    • Compose - Ochestrator, manage/configure multiple-container applications
    • Kitematic - Docker GUI
    • Machine - Encapsulates VM operations
  • PATH modifications

    docker-machine now lives on your path

First run

Create a vm to run actualy docker. (docker is a linux thing so a linux vm is needed)

Machine (docker-machine) is a list of commands that run commands aimed at vm(s) on you machine.

$vmName = 'show-and-tell-docker-machine-vm';
docker-machine create --driver virtualbox $vmName;
Get into the vm that is running docker.
$vmName = 'show-and-tell-docker-machine-vm';
docker-machine start $vmName;
docker-machine env $vmName -shell powershell | Invoke-Expression;
docker-machine ssh $vmName;
Inside the docker-machine vm
  • Options
    • ubuntu/centos/debian

      Spin up a ubuntu box

      # Virtual Box shares stuff by default
      ls /c/Users/simon/projects/show-and-tell-docker
      # spin up a ubuntu, with a mounted folder
      docker run -v /c/Users/simon/projects/show-and-tell-docker:/home/show-and-tell -i -t ubuntu /bin/bash
      
      Params
      1. run - Run a command in a new container
      2. /bin/bash/ - Command to run, This happens to the the folder shared by VirtualBox with $vmName
      3. ubuntu - Image, Pulls from https://hub.docker.com/explore/ if not found locally.
      4. -v - Bind mount a volume, share a directory between docker vm and the docker container
      5. -t - Allocate a pseudo-TTY, make a terminal
      6. -i - Keep STDIN open even if not attached, don't close after running
      cat /etc/*-release
      
    • Jenkins server

      Spin up jenkin

      VBoxManage controlvm "show-and-tell-docker-machine-vm" natpf1 "tcp-port8080,tcp,,8080,,8080";
      VBoxManage controlvm "show-and-tell-docker-machine-vm" natpf1 "tcp-port50000,tcp,,50000,,50000";
      
      docker run -p 8080:8080 -p 50000:50000 -v /c/Users/simon/projects/jenkins:/var/jenkins_home jenkins
      
      Params
      1. run - Run a command in a new container
      2. -p - Portfowarding . This time show-and-tell-docker-machine-vm <-> dockerContainer
      3. -v - Bind mount a volume, share a directory between docker vm and the docker container
      4. jenkins - Image, Pulls from https://hub.docker.com/explore/
Summary
  1. docker-machine : create, start, env connect to vm
  2. docker run -it : run a command
  3. Base Boxes : https://hub.docker.com/explore/
Extra
  • Security is the big issue
    • Who creates the inital boxes?
  • Reconnecting to a container.

    Just start and attach the docker container be feeding in the latest (-l) container id (-q).

    docker start `docker ps -l -q`
    docker attach `docker ps -l -q`