On Github msgre / docker-talk
Povídání pro Tkalce na webu — Michal Valoušek — @msgrehttps://github.com/msgre/docker-talk
LXC (LinuX Containers) is an operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host. AuFS (AnotherUnionFS) is a layered file system, so you can have a read only part, and a write part, and merge those together. So you could have the common parts of the operating system as read only, which are shared amongst all of your containers, and then give each container its own mount for writing. VirtualBox -- izolace. Vagrant -- zpusob ovladani VBoxu. git -- verzovani, repa.
$ docker search ubuntu NAME DESCRIPTION STARS OFFICIAL TRUSTED ubuntu General use Ubuntu base image. Tags availa... 108 stackbrew/ubuntu Barebone ubuntu images 34 # ...
$ docker pull ubuntu Pulling repository ubuntu 5ac751e8d623: Download complete 9cc9ea5ea540: Download complete # ...
typy repozitaru
$ docker run ubuntu echo "hello world" hello world
$ docker run -i -t ubuntu /bin/bash root@1d6a233e6896:/$ root@1d6a233e6896:/$ apt-get install nginx Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: geoip-database libfreetype6 libgcrypt11 libgd2-noxpm libgeoip1 libgpg-error0 libjpeg-turbo8 libjpeg8 libxml2 libxslt1.1 nginx-common nginx-full sgml-base xml-core # ...
vysvetlit rozdil mezi image/kontejnerem
$ docker commit 1d6a233e6896 msgre/pokus1 1762b9c9158f402f33e7eba64a9a80bb87e4768996d6f8a7b6ea108147693e6c
$ docker push msgre/pokus1 The push refers to a repository [msgre/pokus1] (len: 1) Sending image list Pushing repository msgre/pokus1 (1 tags) 511136ea3c5a: Image already pushed, skipping Image 6170bb7b0ad1 already pushed, skipping Image 9cd978db300e already pushed, skipping 1762b9c9158f: Image successfully pushed Pushing tag for rev [1762b9c9158f] on {https://registry-1.docker.io/v1/repositories/msgre/pokus1/tags/latest}
FROM ubuntu MAINTAINER Victor Coisne victor.coisne@dotcloud.com RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update RUN apt-get install -y memcached ENTRYPOINT ["memcached"] USER daemon EXPOSE 11211docker build -t memcached . # +2 dalsi zpusoby (stdin, github) parametr -t hned build i pojmenuje (otaguje) ADD (nakopiruje soubor dovnitr)
# kontejner s Redisem $ docker run -d -name redis msgre/redis # kontejner s aplikaci $ docker run -t -i -link redis:db -name webapp ubuntu /bin/bash $ root@4c01db0b339c:/$ env # ... DB_PORT=tcp://172.17.0.8:6379 DB_PORT_6379_TCP=tcp://172.17.0.8:6379 DB_PORT_6379_TCP_PROTO=tcp DB_PORT_6379_TCP_ADDR=172.17.0.8 DB_PORT_6379_TCP_PORT=6379docker build -t memcached . # +2 dalsi zpusoby (stdin, github) parametr -t hned build i pojmenuje (otaguje) ADD (nakopiruje soubor dovnitr)
# datovy kontejner $ docker run -v /var/volume1 -name DATA busybox true # pripojeni k datovemu kontejneru $ docker run -t -i -volumes-from DATA ubuntu /bin/bash
# nasdileni slozky /var/logs dovnitr kontejneru $ sudo docker run -t -i -v /var/logs:/var/host_logs:ro ubuntu /bin/bashBusyBox provides several stripped-down Unix tools in a single executable file. volumes nejsou soucasti commitu
-i -t otevre terminal
## . ## ## ## == ## ## ## ## === /""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\______/