Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Non-traditional use of Docker (Nette Camp #3)
Search
Vladimír Kriška
August 25, 2017
Programming
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Non-traditional use of Docker (Nette Camp #3)
Vladimír Kriška
August 25, 2017
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
190
Design a REST API you will love to work with
ujovlado
0
820
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
530
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
440
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
150
CSS Flexbox (WebElement #35)
ujovlado
0
210
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
210
Don't underestimate CSS (WebElement #30)
ujovlado
0
650
Database Migrations in PHP (Posobota #66)
ujovlado
0
180
Other Decks in Programming
See All in Programming
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
400
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
130
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
160
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
450
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
350
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
310
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
410
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
30
13k
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
1
680
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
520
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
550
Unsuck your backbone
ammeep
672
58k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
GraphQLとの向き合い方2022年版
quramy
50
15k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Transcript
Non-traditional use of Docker Vladimír Kriška @ujovlado
$ whoami Brogrammer Developer at Keboola building ETL platform Keboola
Connection writing about it at 500.keboola.com WebElement organizer - web dev meetup (on hold) Rekurzia - custom dev trainings twitter.com/ujovlado 2
Why containers? 3
Why containers? Isolation Simplicity One container, one task, one process*
Lock environment No more "works on my machine" problems They're lightweight Almost as native (probably 99.9%) 4
Why Docker? 5
Why Docker? Most popular No VM needed* Easy to learn
Lightweight Fast startup Well supported Docker Compose Docker Swarm, etc. 6
Let's begin! 7
1. Standard usage (for dev) Docker le: FROM node:7 RUN
apt-get update -q \ && apt-get install apt-transport-https \ && wget https://dl.yarnpkg.com/debian/pubkey.gpg -O pubkey.gpg && apt-key add pubkey.gpg \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /et && apt-get update -q \ && apt-get install yarn -y 8
docker-compose.yml: services: node: build: . ports: - "3000:3000" volumes: -
./:/code working_dir: /code tty: true command: sh -c 'yarn && yarn start' and: docker-compose run --rm --service-ports node 9
2. Helpers (e.g. in Travis) services: - docker script: -
... - docker-compose up -d udp-listener - php tests/run.php - docker-compose logs udp-listener | grep 'Some text' check if library made UDP request 10
3. Concurency problems (almost DIND) $ docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \ docker:1.11 \ sh -c 'docker login \ && docker pull some-image \ && docker logout' mounting Docker socket to container Docker in container will run Docker on host logins will not con ict 11
4. Tools you don't want on host e.g. Ruby or
Node PHP ... 12
4.1. Travis CLI to run Travis CLI in container using
host FS FROM ruby:2 RUN gem install travis -v 1.8.2 --no-rdoc --no-ri ARG USER_NAME ARG USER_UID ARG USER_GID RUN groupadd --gid $USER_GID $USER_NAME RUN useradd --uid $USER_UID --gid $USER_GID $USER_NAME ENTRYPOINT ["travis"] 13
4.1. Travis CLI $ docker build -t travis \ --build-arg
USER_UID=`id -u` \ --build-arg USER_GID=`id -g` \ --build-arg USER_NAME=`id -un` \ . $ docker run -i -t --rm \ -v "/home/vlado/workspace/travis-cli/.travis :/home/`id -un`/.travis" \ -u `id -u` \ travis 14
4.1. Travis CLI #!/bin/bash docker run -i -t --rm \
-v "/home/vlado/workspace/travis-cli/.travis :/home/`id -un`/.travis" \ -v "$PWD:$PWD" \ -w $PWD \ -u `id -u` \ travis "$@" 15
5. OpenVPN FROM debian:jessie RUN apt-get update -q \ &&
apt-get install openvpn ssh -y --no-install-recommends ARG USER_NAME ARG USER_UID ARG USER_GID RUN groupadd --gid $USER_GID $USER_NAME \ && useradd --uid $USER_UID --gid $USER_GID \ --shell /bin/bash $USER_NAME COPY entrypoint.sh /root/ ENTRYPOINT ["/root/entrypoint.sh"] 16
Entrypoint: openvpn --daemon --config $1 && su - $SU_USERNAME Build:
docker build -t openvpn \ --build-arg USER_UID=`id -u` \ --build-arg USER_GID=`id -g` \ --build-arg USER_NAME=`id -un` \ . similar Travis CLI 17
Run script: #!/bin/bash SCRIPT_DIR=$(cd `dirname $0`; pwd -P) if [
! -f $SCRIPT_DIR/config/$1 ]; then echo "Specified config file not found" else docker run -i -t --rm \ --device "/dev/net/tun:/dev/net/tun" \ -v "$SCRIPT_DIR/config:/etc/openvpn/config" \ -v "/home/`id -un`/.ssh:/home/`id -un`/.ssh" \ -w "/etc/openvpn/config" \ --cap-add NET_ADMIN \ --env SU_USERNAME=`id -un` \ openvpn $1 fi 18
6. Shared socket services: syslog: build: docker/syslog volumes: - ./docker/.syslog-datadir/socket:/syslog-socket
- ./docker/.syslog-datadir/log:/var/log syslog-watcher: image: debian:8 volumes_from: - syslog command: tail -f /var/log/syslog everything is a le 19
services: apache: build: docker/php-apache volumes: - ... - ./docker/.syslog-datadir/socket/log:/dev/log -
... links: - syslog now you can log to syslog and will see logs using "watcher" service 20
Conclusion you can run any service in Docker in Linux,
everything is a le -> can be mounted super fast onboarding (just docker run/up) clean host system ... 21
Questions? 22