Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to start with docker

How to start with docker

Shows some tips & tricks on how to start with docker for php projects.

8b3f69dcdbfc477777ab524c316168c1?s=128

Toni Van de Voorde

January 27, 2017
Tweet

More Decks by Toni Van de Voorde

Other Decks in Technology

Transcript

  1. How to start with docker Toni Van de Voorde CTO

    @ Adlogix.eu / Adsdaq.eu @tonivdv Unconference
  2. Setup • Native on linux • Docker for Mac/Windows •

    Docker toolbox
  3. Docker For Mac • Pros • “Native” approach • No

    virtualbox (uses lightweight virtualization of mac-os hypervisor framework) • Nice UX • Cons • Shares without NFS • Only 1 virtual machine
  4. Docker Toolbox • Pros • Easy NFS support with docker-machine-nfs

    (OSX only) • Not only 1 virtual machine • Use whatever hypervisor you love (virtualbox, xhyve, parallel, vmware, …) • Cons • Less UX ?
  5. Docker Machine Tips Configure ip range per different box dm

    create \ -d virtualbox --virtualbox-hostonly-cidr "192.168.70.1/24" --virtualbox-disk-size "10000" docker-test
  6. Docker Machine Tips Embrace speed by activating NFS brew install

    docker-machine-nfs $ docker-machine-nfs docker-test https://github.com/adlogix/docker-machine-nfs
  7. General Tips • Dnsmasq + jwilder’s nginx-proxy • Define your

    services with docker-compose • Don’t put sensitive data in the images (ssh keys etc) • Still be careful with case sensitivity
  8. How to with ssh? • Mount to container volumes: -

    ~/.ssh:/root/.ssh • SSH Agent • (hack) Copy to “volume” docker run --rm --name ssh-data -v my-ssh-data:/root/.ssh –v ${USER_PRIVATE_KEY}:/root/.host-ssh:ro busybox sh -c 'cp ~/.host-ssh/* ~/.ssh && chown -R root:root ~/.ssh && chmod -R 400 ~/.ssh’ docker run –v my-ssh-data:/root/.ssh composer ...
  9. Make cli-commands #!/bin/bash cd $(dirname "$0") docker-compose run --rm composer

    "$@” #!/bin/bash cd $(dirname "$0") docker-compose run --rm php-cli php "$@"
  10. Demo

  11. Questions?