mirror of
https://github.com/valitydev/camp-docker-basics.git
synced 2024-11-06 02:15:20 +00:00
Initial commit
This commit is contained in:
commit
dd4cd49330
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.tmp
|
||||
*~
|
191
LICENSE
Normal file
191
LICENSE
Normal file
@ -0,0 +1,191 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2018, Anton Belyaev <xantbel@gmail.com>.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Лекция по основам работы с docker
|
||||
|
||||
> Hints:
|
||||
> - презентация сделана на [backslide](https://sinedied.github.io/backslide/#1). [Инстурция](https://sinedied.github.io/backslide/#3) по запуску [онлайн презентации](http://localhost:4101/presentation.html#1).
|
||||
> - В качестве примера приложения в презентации используется [пустое erlang приложение](example/), сгенерированное из стандартного _rebar3_ шаблона:
|
||||
> ```erlang
|
||||
> rebar3 new release name="<app_name>"
|
||||
> ```
|
18
example/.gitignore
vendored
Normal file
18
example/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
.rebar3
|
||||
_*
|
||||
.eunit
|
||||
*.o
|
||||
*.beam
|
||||
*.plt
|
||||
*.swp
|
||||
*.swo
|
||||
.erlang.cookie
|
||||
ebin
|
||||
log
|
||||
erl_crash.dump
|
||||
.rebar
|
||||
logs
|
||||
_build
|
||||
.idea
|
||||
*.iml
|
||||
rebar3.crashdump
|
21
example/Dockerfile
Normal file
21
example/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
# Compilaton and testing
|
||||
|
||||
FROM erlang:21.0 as build
|
||||
|
||||
COPY ./ /build
|
||||
WORKDIR /build
|
||||
|
||||
RUN rebar3 compile
|
||||
RUN rebar3 do eunit, ct
|
||||
|
||||
RUN rm -rf _build/default/rel
|
||||
RUN rebar3 release
|
||||
|
||||
# Make an app image
|
||||
|
||||
FROM erlang:21.0
|
||||
|
||||
WORKDIR /opt/dummy_docker
|
||||
COPY --from=build /build/_build/default/rel/dummy_docker .
|
||||
|
||||
CMD bin/dummy_docker foreground
|
9
example/README.md
Normal file
9
example/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
dummy_docker
|
||||
=====
|
||||
|
||||
An OTP application
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
$ rebar3 compile
|
16
example/apps/dummy_docker/src/dummy_docker.app.src
Normal file
16
example/apps/dummy_docker/src/dummy_docker.app.src
Normal file
@ -0,0 +1,16 @@
|
||||
{application, dummy_docker,
|
||||
[{description, "An OTP application"},
|
||||
{vsn, "0.1.0"},
|
||||
{registered, []},
|
||||
{mod, { dummy_docker_app, []}},
|
||||
{applications,
|
||||
[kernel,
|
||||
stdlib
|
||||
]},
|
||||
{env,[]},
|
||||
{modules, []},
|
||||
|
||||
{maintainers, []},
|
||||
{licenses, ["Apache 2.0"]},
|
||||
{links, []}
|
||||
]}.
|
26
example/apps/dummy_docker/src/dummy_docker_app.erl
Normal file
26
example/apps/dummy_docker/src/dummy_docker_app.erl
Normal file
@ -0,0 +1,26 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
%% @doc dummy_docker public API
|
||||
%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(dummy_docker_app).
|
||||
|
||||
-behaviour(application).
|
||||
|
||||
%% Application callbacks
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
%%====================================================================
|
||||
%% API
|
||||
%%====================================================================
|
||||
|
||||
start(_StartType, _StartArgs) ->
|
||||
dummy_docker_sup:start_link().
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
stop(_State) ->
|
||||
ok.
|
||||
|
||||
%%====================================================================
|
||||
%% Internal functions
|
||||
%%====================================================================
|
38
example/apps/dummy_docker/src/dummy_docker_sup.erl
Normal file
38
example/apps/dummy_docker/src/dummy_docker_sup.erl
Normal file
@ -0,0 +1,38 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
%% @doc dummy_docker top level supervisor.
|
||||
%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(dummy_docker_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% Supervisor callbacks
|
||||
-export([init/1]).
|
||||
|
||||
-define(SERVER, ?MODULE).
|
||||
|
||||
%%====================================================================
|
||||
%% API functions
|
||||
%%====================================================================
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
%%====================================================================
|
||||
%% Supervisor callbacks
|
||||
%%====================================================================
|
||||
|
||||
%% Child :: #{id => Id, start => {M, F, A}}
|
||||
%% Optional keys are restart, shutdown, type, modules.
|
||||
%% Before OTP 18 tuples must be used to specify a child. e.g.
|
||||
%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
|
||||
init([]) ->
|
||||
{ok, { {one_for_all, 0, 1}, []} }.
|
||||
|
||||
%%====================================================================
|
||||
%% Internal functions
|
||||
%%====================================================================
|
3
example/config/sys.config
Normal file
3
example/config/sys.config
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
{ dummy_docker, []}
|
||||
].
|
6
example/config/vm.args
Normal file
6
example/config/vm.args
Normal file
@ -0,0 +1,6 @@
|
||||
-sname dummy_docker
|
||||
|
||||
-setcookie dummy_docker_cookie
|
||||
|
||||
+K true
|
||||
+A30
|
12
example/docker-compose.yml
Normal file
12
example/docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
dummy:
|
||||
build: ./
|
||||
#command: ping db
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: redis
|
20
example/rebar.config
Normal file
20
example/rebar.config
Normal file
@ -0,0 +1,20 @@
|
||||
{erl_opts, [debug_info]}.
|
||||
{deps, []}.
|
||||
|
||||
{relx, [{release, { dummy_docker, "0.1.0" },
|
||||
[dummy_docker,
|
||||
sasl]},
|
||||
|
||||
{sys_config, "./config/sys.config"},
|
||||
{vm_args, "./config/vm.args"},
|
||||
|
||||
{dev_mode, false},
|
||||
{include_erts, true},
|
||||
|
||||
{extended_start_script, true}]
|
||||
}.
|
||||
|
||||
{profiles, [{prod, [{relx, [{dev_mode, false},
|
||||
{include_erts, true}]}]
|
||||
}]
|
||||
}.
|
1
example/rebar.lock
Normal file
1
example/rebar.lock
Normal file
@ -0,0 +1 @@
|
||||
[].
|
308
presentation.md
Normal file
308
presentation.md
Normal file
@ -0,0 +1,308 @@
|
||||
title: Docker basics hands-on
|
||||
class: animation-fade
|
||||
layout: true
|
||||
|
||||
<!-- This slide will serve as the base layout for all your slides -->
|
||||
.bottom-bar[
|
||||
{{title}}
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
class: impact
|
||||
|
||||
# {{title}}
|
||||
|
||||
---
|
||||
|
||||
# Что такое Docker
|
||||
|
||||
<img src="https://cdn-images-1.medium.com/max/1400/1*9eqkIxHnho9ny2Tym5-I-w.jpeg" style="height:400px; float:right"/>
|
||||
|
||||
--
|
||||
|
||||
## Инфраструктура для
|
||||
|
||||
- упаковки
|
||||
|
||||
- хранения
|
||||
|
||||
- доставки
|
||||
|
||||
- запуска
|
||||
|
||||
- оркестрации
|
||||
|
||||
## приложений
|
||||
|
||||
---
|
||||
|
||||
# На чем это строится
|
||||
|
||||
--
|
||||
|
||||
- _Контейнеризация_ - виртуализация на уровне операционной системы Linux
|
||||
|
||||
- Контейнеры используют общее ядро операционной системы
|
||||
|
||||
- Изоляция с помощью [cgroups](https://en.wikipedia.org/wiki/Cgroups) и [namespaces](https://en.wikipedia.org/wiki/Linux_namespaces)
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Основные понятия
|
||||
|
||||
--
|
||||
|
||||
<img src="https://docs.docker.com/engine/images/architecture.svg" style="height:450px; float:right"/>
|
||||
|
||||
- Container
|
||||
|
||||
- Image
|
||||
|
||||
- Layer
|
||||
|
||||
- Docker host
|
||||
|
||||
- Docker registry
|
||||
|
||||
---
|
||||
|
||||
class: impact
|
||||
|
||||
# Практика
|
||||
|
||||
---
|
||||
|
||||
# Работа с контейнерами
|
||||
--
|
||||
|
||||
Запустить ubuntu контейнер и зайти в bash в интерактивном режиме:
|
||||
```shell
|
||||
$ docker run -it ubuntu /bin/bash
|
||||
```
|
||||
--
|
||||
|
||||
То же, но примонтировав текущую хостовую дирректорию, причем, по одноименному пути:
|
||||
```shell
|
||||
$ docker run --rm -i -t -v "$PWD":"$PWD" --workdir "$PWD" ubuntu /bin/bash
|
||||
```
|
||||
--
|
||||
|
||||
Выполнить команду в новом процессе уже запущенного контейнера, например интерактивно зайти в новый bash шелл:
|
||||
```shell
|
||||
$ docker exec -it <container id | name> /bin/bash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Работа с контейнерами
|
||||
|
||||
Посмотреть все запущенные контейнеры:
|
||||
|
||||
```shell
|
||||
$ docker ps
|
||||
```
|
||||
--
|
||||
|
||||
Посмотреть все созданные контейнеры, включая незапущенные:
|
||||
```shell
|
||||
$ docker ps -a
|
||||
```
|
||||
|
||||
Удалить контейнер (флаг `-f`: _forse_ удаление, даже запущенного контейнера):
|
||||
```shell
|
||||
$ docker rm <container id | name>
|
||||
```
|
||||
---
|
||||
|
||||
# Работа с образами
|
||||
|
||||
--
|
||||
|
||||
Посмотреть все образы на локальном docker host:
|
||||
```shell
|
||||
$ docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
ubuntu latest 16508e5c265d 7 days ago 84.1MB
|
||||
```
|
||||
--
|
||||
|
||||
Скачать новый образ:
|
||||
```shell
|
||||
$ docker pull hello-world:latest
|
||||
```
|
||||
|
||||
```shell
|
||||
$ docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
ubuntu latest 16508e5c265d 7 days ago 84.1MB
|
||||
hello-world latest 2cb0d9787c4d 7 weeks ago 1.85kB
|
||||
```
|
||||
--
|
||||
|
||||
Удалить докер образ (флаг `-f`: _forse_ удаление):
|
||||
```shell
|
||||
$ docker rmi
|
||||
```
|
||||
---
|
||||
|
||||
# Работа с образами
|
||||
|
||||
## Dockerfile. Cборка и тестрование приложения
|
||||
--
|
||||
|
||||
В дирректории с проектом создаем _Dockerfile_
|
||||
|
||||
--
|
||||
```dockerfile
|
||||
# Compilaton and testing
|
||||
FROM erlang:21.0 as build
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
COPY ./ /build
|
||||
WORKDIR /build
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
RUN rebar3 compile
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
RUN rebar3 do eunit, ct
|
||||
```
|
||||
---
|
||||
# Работа с образами
|
||||
|
||||
## Билд образа
|
||||
|
||||
--
|
||||
```shell
|
||||
$ docker build ./
|
||||
Sending build context to Docker daemon 1.859MB
|
||||
Step 1/11 : FROM erlang:21.0 as build
|
||||
---> 51aeeaecddeb
|
||||
|
||||
...
|
||||
Removing intermediate container 595f1fdee99c
|
||||
---> f5b5d971f2e0
|
||||
Successfully built f5b5d971f2e0
|
||||
```
|
||||
|
||||
- `./` - путь к дирректории с _Dockerfile_.
|
||||
---
|
||||
|
||||
# Работа с образами
|
||||
|
||||
## Dockerfile. Сборка и упаковка приложения
|
||||
--
|
||||
|
||||
В том же _Dockerfile_:
|
||||
```dockerfile
|
||||
RUN rm -rf _build/default/rel
|
||||
RUN rebar3 release
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
# Make an app image
|
||||
FROM erlang:21.0
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
WORKDIR /opt/dummy_docker
|
||||
COPY --from=build /build/_build/default/rel/dummy_docker .
|
||||
```
|
||||
--
|
||||
```dockerfile
|
||||
CMD bin/dummy_docker foreground
|
||||
```
|
||||
---
|
||||
# Работа с образами
|
||||
|
||||
## Билд образа. Финальный
|
||||
|
||||
--
|
||||
```shell
|
||||
$ docker build --squash -t dummy_docker:<tag> ./
|
||||
|
||||
Sending build context to Docker daemon 1.859MB
|
||||
Step 1/11 : FROM erlang:21.0 as build
|
||||
---> 51aeeaecddeb
|
||||
|
||||
...
|
||||
Step 11/11 : CMD bin/dummy_docker foreground
|
||||
---> Running in 94d00e80215c
|
||||
Removing intermediate container 94d00e80215c
|
||||
---> 87ad77b501bd
|
||||
Successfully built 3d10516ba341
|
||||
Successfully tagged dummy_docker:2018-08-30-19-15-15
|
||||
```
|
||||
|
||||
- Таймстэмп в качестве тэга: `$(date +%Y-%m-%d-%H-%M-%S)`
|
||||
---
|
||||
|
||||
# Работа с зависимостями
|
||||
|
||||
## docker-compose.yml
|
||||
|
||||
В дирректории с проектом создаем _docker-compose.yml_
|
||||
|
||||
--
|
||||
```yaml
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
dummy:
|
||||
# build from Dockerfile
|
||||
build: ./
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
# pull and start from an image
|
||||
image: redis:4.0
|
||||
|
||||
```
|
||||
---
|
||||
|
||||
# Работа с зависимостями
|
||||
|
||||
## Запуск
|
||||
|
||||
```shell
|
||||
$ docker-compose up -d
|
||||
```
|
||||
--
|
||||
```shell
|
||||
$ docker-compose ps
|
||||
Name Command State Ports
|
||||
---------------------------------------------------------------------
|
||||
dummy_docker_db_1 docker-entrypoint.sh redis ... Up 6379/tcp
|
||||
dummy_docker_dummy_1 /bin/sh -c bin/dummy_docke ... Up
|
||||
```
|
||||
---
|
||||
|
||||
# Работа с зависимостями
|
||||
|
||||
## Связность и остановка
|
||||
Docker compose обеспечивает связь между контейнерами по `service` имени в _docker-compoe.yml_
|
||||
|
||||
```shell
|
||||
$ docker exec -it dummy_docker_dummy_1 ping db
|
||||
PING db (172.23.0.2) 56(84) bytes of data.
|
||||
64 bytes from dummy_docker_db_1.dummy_docker_default (172.23.0.2): icmp_seq=1 ttl=64 time=0.093 ms
|
||||
^C
|
||||
--- db ping statistics ---
|
||||
1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
rtt min/avg/max/mdev = 0.093/0.093/0.093/0.000 ms
|
||||
```
|
||||
|
||||
--
|
||||
```shell
|
||||
$ docker-compose down
|
||||
```
|
||||
---
|
||||
|
||||
class: impact
|
||||
|
||||
# Спасибо!
|
22
template/index.html
Normal file
22
template/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{title}}</title>
|
||||
{{{style}}}
|
||||
<script src="remark.min.js"></script>
|
||||
<script>
|
||||
function create() {
|
||||
return remark.create({
|
||||
{{{source}}},
|
||||
ratio: '16:9',
|
||||
highlightLines: true,
|
||||
countIncrementalSlides: false,
|
||||
highlightStyle: 'github'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="slideshow = create()">
|
||||
</body>
|
||||
</html>
|
18
template/remark.min.js
vendored
Normal file
18
template/remark.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
216
template/style.scss
Normal file
216
template/style.scss
Normal file
@ -0,0 +1,216 @@
|
||||
// Theme
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
$primary : #3F51B5;
|
||||
$secondary : #009688;
|
||||
$tertiary : #757575;
|
||||
$light : #FFF;
|
||||
$dark : #333;
|
||||
$text-dark : #212121;
|
||||
$text-light : $light;
|
||||
$code-background : #F8F8F8;
|
||||
$overlay : transparentize(#000, .5);
|
||||
$font-size : 28px;
|
||||
$font-size-impact : 128px;
|
||||
$font : Arial, Helvetica, sans-serif;
|
||||
$font-title : Arial, Helvetica, sans-serif;
|
||||
$font-fixed : 'Lucida Console', Monaco, monospace;
|
||||
$margin : 20px;
|
||||
$iframe-scale : 1.5;
|
||||
|
||||
|
||||
// CSS Base
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body { font-family: $font; }
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0 0 $margin 0;
|
||||
font-family: $font-title;
|
||||
}
|
||||
h1 { color: $primary; }
|
||||
h2 { color: $secondary; }
|
||||
h3 { color: $tertiary; }
|
||||
li { margin-bottom: .25em; };
|
||||
pre, code {
|
||||
text-align: left;
|
||||
font-family: $font-fixed;
|
||||
color: $secondary;
|
||||
background: $code-background;
|
||||
}
|
||||
a, a:visited, a:hover, a:active { color: $text-dark; }
|
||||
img { vertical-align: inherit; }
|
||||
blockquote {
|
||||
border-left: 8px solid;
|
||||
padding-left: .5em;
|
||||
color: $tertiary;
|
||||
text-align: left;
|
||||
margin: 1em 0;
|
||||
& > p { margin: 0; }
|
||||
}
|
||||
|
||||
|
||||
// Remark base
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.remark-code { font-size: .9em; }
|
||||
.remark-container { background: $dark; }
|
||||
.remark-slide-scaler { box-shadow: none; }
|
||||
.remark-notes { font-size: 1.5em; }
|
||||
|
||||
.remark-slide-content {
|
||||
font-size: $font-size;
|
||||
padding: 1em 2em;
|
||||
color: $text-dark;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.remark-slide-number {
|
||||
color: $text-light;
|
||||
right: 1em;
|
||||
opacity: .6;
|
||||
font-size: 0.8em;
|
||||
z-index: 2;
|
||||
.no-counter & { display: none; }
|
||||
}
|
||||
|
||||
// Additions
|
||||
.impact {
|
||||
background-color: $primary;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
&, h1, h2 { color: $text-light; }
|
||||
h1 { font-size: $font-size-impact; }
|
||||
}
|
||||
|
||||
.full {
|
||||
&, h1, h2 { color: $text-light; }
|
||||
&iframe {
|
||||
height: calc(#{100%/$iframe-scale} - 1.2em);
|
||||
width: 100%/$iframe-scale;
|
||||
transform: scale($iframe-scale);
|
||||
transform-origin: 0 0;
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
background-color: $primary;
|
||||
color: $text-light;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
font-size: 20px;
|
||||
padding: .8em;
|
||||
text-align: left;
|
||||
z-index: 1;
|
||||
p { margin: 0;}
|
||||
.impact &, .full & { display: none; }
|
||||
}
|
||||
|
||||
|
||||
// Utilities
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Positioning
|
||||
.side-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 0 2em;
|
||||
}
|
||||
.middle { &, & img, & span { vertical-align: middle; } };
|
||||
.top { vertical-align: top; };
|
||||
.bottom { vertical-align: bottom; };
|
||||
.inline-block {
|
||||
p, ul, ol, blockquote {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
.no-margin { &, & > p, & > pre, & > ul, & > ol { margin: 0; } }
|
||||
.no-padding { padding: 0; }
|
||||
.space-left { padding-left: 1em; }
|
||||
.space-right { padding-right: 1em; }
|
||||
|
||||
// Images
|
||||
.responsive > img { width: 100%; height: auto; };
|
||||
.contain { background-size: contain; };
|
||||
.overlay { box-shadow: inset 0 0 0 9999px $overlay; }
|
||||
|
||||
// Text
|
||||
.left { text-align: left; }
|
||||
.right { text-align: right; }
|
||||
.center { text-align: center; }
|
||||
.justify { text-align: justify; }
|
||||
.primary { color: $primary; }
|
||||
.alt { color: $secondary; };
|
||||
.em { color: $tertiary; };
|
||||
.thin { font-weight: 200; }
|
||||
.huge { font-size: 2em; }
|
||||
.big { font-size: 1.5em; }
|
||||
.small { font-size: .8em; }
|
||||
.dark-bg { background-color: $dark; }
|
||||
.alt-bg { background-color: $secondary; };
|
||||
|
||||
// Simple 12-columns grid system
|
||||
.row {
|
||||
width: 100%;
|
||||
&::after {
|
||||
content: '';
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
&.table { display: table; };
|
||||
&.table [class^="col-"] {
|
||||
float: none;
|
||||
display: table-cell;
|
||||
vertical-align: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
[class^="col-"] {
|
||||
float: left;
|
||||
&.inline-block {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
@for $i from 1 through 12 {
|
||||
.col-#{$i} {width: 100% / 12 * $i; }
|
||||
}
|
||||
|
||||
// Animations
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
.animation-fade {
|
||||
animation-duration: 300ms;
|
||||
animation-fill-mode: both;
|
||||
animation-timing-function: ease-out;
|
||||
.remark-visible & { animation-name: fadeIn; }
|
||||
}
|
||||
|
||||
|
||||
// Fix PDF print with chrome
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@page {
|
||||
// 908px 681px for 4/3 slides
|
||||
size: 1210px 681px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.remark-slide-scaler {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
transform: scale(1) !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user