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
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
run
- Run a command in a new container/bin/bash/
- Command to run, This happens to the the folder shared by VirtualBox with $vmNameubuntu
- Image, Pulls from https://hub.docker.com/explore/ if not found locally.-v
- Bind mount a volume, share a directory between docker vm and the docker container-t
- Allocate a pseudo-TTY, make a terminal-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
run
- Run a command in a new container-p
- Portfowarding . This time show-and-tell-docker-machine-vm <-> dockerContainer-v
- Bind mount a volume, share a directory between docker vm and the docker containerjenkins
- Image, Pulls from https://hub.docker.com/explore/
- ubuntu/centos/debian
Summary
docker-machine
: create, start, env connect to vmdocker run -it
: run a command- Base Boxes : https://hub.docker.com/explore/