SlideShare a Scribd company logo
1 of 27
Containerization Basics
AcademyPRO
Today’s
agenda
● Vocabulary
● Run static website
● Build & Run own image
● Logs
Vocabulary: Images
Images - The file system and configuration of our application which are used to
create containers.
Vocabulary: Containers
Containers - Running instances of Docker images — containers run the actual
applications.
A container includes an application and all of its dependencies. It shares the
kernel with other containers, and runs as an isolated process in user space on
the host OS.
A list of running containers can be seen using the docker ps command.
Vocabulary: Daemon & Client
Docker daemon - The background service running on the host that manages
building, running and distributing Docker containers.
Docker client - The command line tool that allows the user to interact with the
Docker daemon.
Vocabulary: Hub
Docker Hub - A registry of Docker images. You can think of the registry as a
directory of all available Docker images.
Run a static website in a container
docker run nginx
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
585e0876dad1 nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 80/tcp, 443/tcp goofy_payne
docker stop 585e0876dad1
docker rm 585e0876dad1
Run a static website in a container
(Successful)
docker run -d -P nginx
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
585e0876dad1 nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 0.0.0.0:32769->80/tcp, goofy_payne
0.0.0.0:32768->443/tcp
docker port goofy_payne
443/tcp -> 0.0.0.0:32768
80/tcp -> 0.0.0.0:32769
Run a static website in a container
(Successful) Attempt #2
docker run --name static-site -d -p 8888:80 nginx
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f21f39e4cfa nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 0.0.0.0:8888->80/tcp, static-site
443/tcp
docker rm -f static-site
Docker Images
To see the list of images that are available locally on your system, run the
docker images command.
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 00f017a8c2a6 2 months ago 1.11 MB
hello-world latest 48b5124b2768 3 months ago 1.84 kB
nginx latest 4a88d06e26f4 7 months ago 184 MB
Also you could pull a specific version of image as follows:
docker pull node:0.10
Docker search
To get a new Docker image you can either get it from a registry (such as the
Docker Hub) or create your own. There are hundreds of thousands of images
available on Docker hub. You can also search for images directly from the
command line using docker search.
Base & Child Images
An important distinction with regard to images is between base images and
child images.
● Base images are images that have no parent images, usually images with
an OS like ubuntu, alpine or debian.
● Child images are images that build on base images and add additional
functionality.
Official & User Images
Official
Another key concept is the idea of official images and user images. (Both of
which can be base images or child images.)
● Official images are Docker sanctioned images. Docker, Inc. sponsors a
dedicated team that is responsible for reviewing and publishing all Official
Repositories content. This team works in collaboration with upstream
software maintainers, security experts, and the broader Docker
community. These are not prefixed by an organization or username. In the
list of images above, the python, node, alpine and nginx images are official
(base) images.
Official & User Images
User
● User images are images created and shared by users like you. They build
on base images and add additional functionality. Typically these are
formatted as user/image-name. The user value in the image name is your
Docker Hub user or organization name.
Dockerfile commands summary
FROM
FROM starts the Dockerfile. It is a requirement that the Dockerfile must start
with the FROM command. Images are created in layers, which means you can
use another image as the base image for your own. The FROM command
defines your base layer. As arguments, it takes the name of the image.
Optionally, you can add the Docker Hub username of the maintainer and image
version, in the format username/imagename:version.
Dockerfile commands summary
RUN
RUN is used to build up the Image you're creating. For each RUN command,
Docker will run the command then create a new layer of the image. This way
you can roll back your image to previous states easily. The syntax for a RUN
instruction is to place the full text of the shell command after the RUN (e.g., RUN
mkdir /user/local/foo). This will automatically run in a /bin/sh shell.
You can define a different shell like this: RUN /bin/bash -c 'mkdir
/user/local/foo'
Dockerfile commands summary
COPY & CMD
COPY copies local files into the container.
CMD defines the commands that will run on the Image at start-up. Unlike a RUN,
this does not create a new layer for the Image, but simply runs the command.
There can only be one CMD per a Dockerfile/Image. If you need to run multiple
commands, the best way to do that is to have the CMD run a script. CMD
requires that you tell it where to run the command, unlike RUN. So example CMD
commands would be:
CMD ["python", "./app.py"]
CMD ["/bin/bash", "echo", "Hello World"]
Dockerfile commands summary
Expose & Push
EXPOSE opens ports in your image to allow communication to the outside
world when it runs in a container.
PUSH pushes your image to Docker Hub, or alternately to a private registry
Build image
docker build -t oleksandrkovalov/node_example .
docker run -d -p 8080:3000 oleksandrkovalov/node_example
Push image
docker login
docker push oleksandrkovalov/node_example
The push refers to a repository [docker.io/oleksandrkovalov/node_example]
a6cc0f5939b9: Pushed
...
5d6cbe0dbcf9: Pushed
latest: digest: sha256:239f102592ae13843da87bd61225fe40c686e869ff747f6e613dde8806c99009 size: 2837
Container logging
● Container PID 1 process output can be viewed with docker logs command
● Will show whatever PID 1 writes to stdout
View the output of the containers PID 1 process
docker logs <container name>
View and follow the output
docker logs -f <container name>
Container application logs
● Typically, apps have a well defined log location
● Map a host folder to the application’s log folder in the container
● In this way you can view the log generated in the container from your host
folder
Run a container using nginx image and mount a volume to map the
/tmp/nginxlogs folder in the host to the /var/log/nginx folder in the
container
docker run -d -P -v /tmp/nginxlogs:/var/log/nginx nginx
Private registry
● Allows you to run own registry instead of using Docker Hub
● Multiple options
○ Run registry server using container
○ Docker Hub Enterprise
● Two versions
○ Registry 1.0 for Docker 1.5 and below
○ Registry 2.0 for Docker 1.6
Setting up private registry
● Run a registry inside a container
● Use the registry image at http://registry.hub.docker.com/u/library/registry
● Image contains pre-configured registry v2.0
Run registry:
docker run -d -p 5000:5000 registry
Push and pull from private registry
● First tag image with host IP or domain of registry server, then run docker
push
Tag image and specify the registry host:
docker tag <image id> localhost:5000/my-app:1.0
Push image to registry:
docker push localhost:5000/my-app:1.0
Pull image from registry:
docker pull localhost:5000/my-app:1.0
Any questions?
The end
for today :)

More Related Content

What's hot

Docker puebla bday #4 celebration
Docker puebla bday #4 celebrationDocker puebla bday #4 celebration
Docker puebla bday #4 celebrationRamon Morales
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker ComposeJustin Crown
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdockerJaehwa Park
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmMario IC
 
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaWhen Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaGiovanni Toraldo
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & MachineEueung Mulyana
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Thomas Chacko
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker composeLinkMe Srl
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to DockerAdrian Otto
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 

What's hot (20)

Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Docker puebla bday #4 celebration
Docker puebla bday #4 celebrationDocker puebla bday #4 celebration
Docker puebla bday #4 celebration
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
From zero to Docker
From zero to DockerFrom zero to Docker
From zero to Docker
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
 
Docker Presentation
Docker PresentationDocker Presentation
Docker Presentation
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
 
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaWhen Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
 
Docker / Ansible
Docker / AnsibleDocker / Ansible
Docker / Ansible
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Docker compose
Docker composeDocker compose
Docker compose
 
Docker linuxday 2015
Docker linuxday 2015Docker linuxday 2015
Docker linuxday 2015
 

Viewers also liked

Oracle database on Docker Container
Oracle database on Docker ContainerOracle database on Docker Container
Oracle database on Docker ContainerJesus Guzman
 
Docker in the Oracle Universe / WebLogic 12c / OFM 12c
Docker in the Oracle Universe / WebLogic 12c / OFM 12cDocker in the Oracle Universe / WebLogic 12c / OFM 12c
Docker in the Oracle Universe / WebLogic 12c / OFM 12cFrank Munz
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsZohar Elkayam
 
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...Jérôme Petazzoni
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemBruno Borges
 
Academy PRO: D3, part 3
Academy PRO: D3, part 3Academy PRO: D3, part 3
Academy PRO: D3, part 3Binary Studio
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Alphorm.com Formation Docker (2/2) - Administration Avancée
Alphorm.com Formation Docker (2/2) - Administration Avancée Alphorm.com Formation Docker (2/2) - Administration Avancée
Alphorm.com Formation Docker (2/2) - Administration Avancée Alphorm
 

Viewers also liked (9)

Oracle database on Docker Container
Oracle database on Docker ContainerOracle database on Docker Container
Oracle database on Docker Container
 
Docker in the Oracle Universe / WebLogic 12c / OFM 12c
Docker in the Oracle Universe / WebLogic 12c / OFM 12cDocker in the Oracle Universe / WebLogic 12c / OFM 12c
Docker in the Oracle Universe / WebLogic 12c / OFM 12c
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic Functions
 
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
Academy PRO: D3, part 3
Academy PRO: D3, part 3Academy PRO: D3, part 3
Academy PRO: D3, part 3
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Alphorm.com Formation Docker (2/2) - Administration Avancée
Alphorm.com Formation Docker (2/2) - Administration Avancée Alphorm.com Formation Docker (2/2) - Administration Avancée
Alphorm.com Formation Docker (2/2) - Administration Avancée
 

Similar to Academy PRO: Docker. Part 2

Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Binary Studio
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanThierry Gayet
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101Naukri.com
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Will Hall
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Alessandro Mignogna
 
Master Docker - first meetup
Master Docker - first meetupMaster Docker - first meetup
Master Docker - first meetupAyoub Benaissa
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Docker presentation
Docker presentationDocker presentation
Docker presentationthehoagie
 
Docker in a JS Developer’s Life
Docker in a JS Developer’s LifeDocker in a JS Developer’s Life
Docker in a JS Developer’s LifeGlobalLogic Ukraine
 

Similar to Academy PRO: Docker. Part 2 (20)

Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker @ Atlogys
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Docker
DockerDocker
Docker
 
Docker.pdf
Docker.pdfDocker.pdf
Docker.pdf
 
Docker
DockerDocker
Docker
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podman
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
How to _docker
How to _dockerHow to _docker
How to _docker
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
 
Master Docker - first meetup
Master Docker - first meetupMaster Docker - first meetup
Master Docker - first meetup
 
Docker
DockerDocker
Docker
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Docker in a JS Developer’s Life
Docker in a JS Developer’s LifeDocker in a JS Developer’s Life
Docker in a JS Developer’s Life
 

More from Binary Studio

Academy PRO: D3, part 1
Academy PRO: D3, part 1Academy PRO: D3, part 1
Academy PRO: D3, part 1Binary Studio
 
Academy PRO: Cryptography 3
Academy PRO: Cryptography 3Academy PRO: Cryptography 3
Academy PRO: Cryptography 3Binary Studio
 
Academy PRO: Cryptography 1
Academy PRO: Cryptography 1Academy PRO: Cryptography 1
Academy PRO: Cryptography 1Binary Studio
 
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobXAcademy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobXBinary Studio
 
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - OrderlyBinary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - OrderlyBinary Studio
 
Binary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - UnicornBinary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - UnicornBinary Studio
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousBinary Studio
 
Academy PRO: React native - publish
Academy PRO: React native - publishAcademy PRO: React native - publish
Academy PRO: React native - publishBinary Studio
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigationBinary Studio
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenesBinary Studio
 
Academy PRO: React Native - introduction
Academy PRO: React Native - introductionAcademy PRO: React Native - introduction
Academy PRO: React Native - introductionBinary Studio
 
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis BeketskyAcademy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis BeketskyBinary Studio
 
Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1Binary Studio
 
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5Binary Studio
 
Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js in production. lecture 4Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js in production. lecture 4Binary Studio
 
Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js alternative stacks. Lecture 3Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js alternative stacks. Lecture 3Binary Studio
 
Academy PRO: Node.js default stack. Lecture 2
Academy PRO: Node.js default stack. Lecture 2Academy PRO: Node.js default stack. Lecture 2
Academy PRO: Node.js default stack. Lecture 2Binary Studio
 
Academy PRO: Node.js platform. Lecture 1
Academy PRO: Node.js platform. Lecture 1  Academy PRO: Node.js platform. Lecture 1
Academy PRO: Node.js platform. Lecture 1 Binary Studio
 
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
SubmitJS: Developing desktop applications with Electron. Mykyta SemenistyiSubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
SubmitJS: Developing desktop applications with Electron. Mykyta SemenistyiBinary Studio
 
SubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
SubmitJS: Is react + redux + typescript a good combination? Dmytro BesedaSubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
SubmitJS: Is react + redux + typescript a good combination? Dmytro BesedaBinary Studio
 

More from Binary Studio (20)

Academy PRO: D3, part 1
Academy PRO: D3, part 1Academy PRO: D3, part 1
Academy PRO: D3, part 1
 
Academy PRO: Cryptography 3
Academy PRO: Cryptography 3Academy PRO: Cryptography 3
Academy PRO: Cryptography 3
 
Academy PRO: Cryptography 1
Academy PRO: Cryptography 1Academy PRO: Cryptography 1
Academy PRO: Cryptography 1
 
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobXAcademy PRO: Advanced React Ecosystem. MobX
Academy PRO: Advanced React Ecosystem. MobX
 
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - OrderlyBinary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: JS team project - Orderly
 
Binary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - UnicornBinary Studio Academy 2017: .NET team project - Unicorn
Binary Studio Academy 2017: .NET team project - Unicorn
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneous
 
Academy PRO: React native - publish
Academy PRO: React native - publishAcademy PRO: React native - publish
Academy PRO: React native - publish
 
Academy PRO: React native - navigation
Academy PRO: React native - navigationAcademy PRO: React native - navigation
Academy PRO: React native - navigation
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenes
 
Academy PRO: React Native - introduction
Academy PRO: React Native - introductionAcademy PRO: React Native - introduction
Academy PRO: React Native - introduction
 
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis BeketskyAcademy PRO: Push notifications. Denis Beketsky
Academy PRO: Push notifications. Denis Beketsky
 
Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1Academy PRO: Docker. Lecture 1
Academy PRO: Docker. Lecture 1
 
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js - miscellaneous. Lecture 5
 
Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js in production. lecture 4Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js in production. lecture 4
 
Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js alternative stacks. Lecture 3Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js alternative stacks. Lecture 3
 
Academy PRO: Node.js default stack. Lecture 2
Academy PRO: Node.js default stack. Lecture 2Academy PRO: Node.js default stack. Lecture 2
Academy PRO: Node.js default stack. Lecture 2
 
Academy PRO: Node.js platform. Lecture 1
Academy PRO: Node.js platform. Lecture 1  Academy PRO: Node.js platform. Lecture 1
Academy PRO: Node.js platform. Lecture 1
 
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
SubmitJS: Developing desktop applications with Electron. Mykyta SemenistyiSubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
 
SubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
SubmitJS: Is react + redux + typescript a good combination? Dmytro BesedaSubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
SubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Recently uploaded (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

Academy PRO: Docker. Part 2

  • 2. Today’s agenda ● Vocabulary ● Run static website ● Build & Run own image ● Logs
  • 3. Vocabulary: Images Images - The file system and configuration of our application which are used to create containers.
  • 4. Vocabulary: Containers Containers - Running instances of Docker images — containers run the actual applications. A container includes an application and all of its dependencies. It shares the kernel with other containers, and runs as an isolated process in user space on the host OS. A list of running containers can be seen using the docker ps command.
  • 5. Vocabulary: Daemon & Client Docker daemon - The background service running on the host that manages building, running and distributing Docker containers. Docker client - The command line tool that allows the user to interact with the Docker daemon.
  • 6. Vocabulary: Hub Docker Hub - A registry of Docker images. You can think of the registry as a directory of all available Docker images.
  • 7. Run a static website in a container docker run nginx docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 585e0876dad1 nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 80/tcp, 443/tcp goofy_payne docker stop 585e0876dad1 docker rm 585e0876dad1
  • 8. Run a static website in a container (Successful) docker run -d -P nginx docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 585e0876dad1 nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 0.0.0.0:32769->80/tcp, goofy_payne 0.0.0.0:32768->443/tcp docker port goofy_payne 443/tcp -> 0.0.0.0:32768 80/tcp -> 0.0.0.0:32769
  • 9. Run a static website in a container (Successful) Attempt #2 docker run --name static-site -d -p 8888:80 nginx docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0f21f39e4cfa nginx "nginx -g 'daemon ..." About a minute ago Up About a minute 0.0.0.0:8888->80/tcp, static-site 443/tcp docker rm -f static-site
  • 10. Docker Images To see the list of images that are available locally on your system, run the docker images command. docker images REPOSITORY TAG IMAGE ID CREATED SIZE busybox latest 00f017a8c2a6 2 months ago 1.11 MB hello-world latest 48b5124b2768 3 months ago 1.84 kB nginx latest 4a88d06e26f4 7 months ago 184 MB Also you could pull a specific version of image as follows: docker pull node:0.10
  • 11. Docker search To get a new Docker image you can either get it from a registry (such as the Docker Hub) or create your own. There are hundreds of thousands of images available on Docker hub. You can also search for images directly from the command line using docker search.
  • 12. Base & Child Images An important distinction with regard to images is between base images and child images. ● Base images are images that have no parent images, usually images with an OS like ubuntu, alpine or debian. ● Child images are images that build on base images and add additional functionality.
  • 13. Official & User Images Official Another key concept is the idea of official images and user images. (Both of which can be base images or child images.) ● Official images are Docker sanctioned images. Docker, Inc. sponsors a dedicated team that is responsible for reviewing and publishing all Official Repositories content. This team works in collaboration with upstream software maintainers, security experts, and the broader Docker community. These are not prefixed by an organization or username. In the list of images above, the python, node, alpine and nginx images are official (base) images.
  • 14. Official & User Images User ● User images are images created and shared by users like you. They build on base images and add additional functionality. Typically these are formatted as user/image-name. The user value in the image name is your Docker Hub user or organization name.
  • 15. Dockerfile commands summary FROM FROM starts the Dockerfile. It is a requirement that the Dockerfile must start with the FROM command. Images are created in layers, which means you can use another image as the base image for your own. The FROM command defines your base layer. As arguments, it takes the name of the image. Optionally, you can add the Docker Hub username of the maintainer and image version, in the format username/imagename:version.
  • 16. Dockerfile commands summary RUN RUN is used to build up the Image you're creating. For each RUN command, Docker will run the command then create a new layer of the image. This way you can roll back your image to previous states easily. The syntax for a RUN instruction is to place the full text of the shell command after the RUN (e.g., RUN mkdir /user/local/foo). This will automatically run in a /bin/sh shell. You can define a different shell like this: RUN /bin/bash -c 'mkdir /user/local/foo'
  • 17. Dockerfile commands summary COPY & CMD COPY copies local files into the container. CMD defines the commands that will run on the Image at start-up. Unlike a RUN, this does not create a new layer for the Image, but simply runs the command. There can only be one CMD per a Dockerfile/Image. If you need to run multiple commands, the best way to do that is to have the CMD run a script. CMD requires that you tell it where to run the command, unlike RUN. So example CMD commands would be: CMD ["python", "./app.py"] CMD ["/bin/bash", "echo", "Hello World"]
  • 18. Dockerfile commands summary Expose & Push EXPOSE opens ports in your image to allow communication to the outside world when it runs in a container. PUSH pushes your image to Docker Hub, or alternately to a private registry
  • 19. Build image docker build -t oleksandrkovalov/node_example . docker run -d -p 8080:3000 oleksandrkovalov/node_example
  • 20. Push image docker login docker push oleksandrkovalov/node_example The push refers to a repository [docker.io/oleksandrkovalov/node_example] a6cc0f5939b9: Pushed ... 5d6cbe0dbcf9: Pushed latest: digest: sha256:239f102592ae13843da87bd61225fe40c686e869ff747f6e613dde8806c99009 size: 2837
  • 21. Container logging ● Container PID 1 process output can be viewed with docker logs command ● Will show whatever PID 1 writes to stdout View the output of the containers PID 1 process docker logs <container name> View and follow the output docker logs -f <container name>
  • 22. Container application logs ● Typically, apps have a well defined log location ● Map a host folder to the application’s log folder in the container ● In this way you can view the log generated in the container from your host folder Run a container using nginx image and mount a volume to map the /tmp/nginxlogs folder in the host to the /var/log/nginx folder in the container docker run -d -P -v /tmp/nginxlogs:/var/log/nginx nginx
  • 23. Private registry ● Allows you to run own registry instead of using Docker Hub ● Multiple options ○ Run registry server using container ○ Docker Hub Enterprise ● Two versions ○ Registry 1.0 for Docker 1.5 and below ○ Registry 2.0 for Docker 1.6
  • 24. Setting up private registry ● Run a registry inside a container ● Use the registry image at http://registry.hub.docker.com/u/library/registry ● Image contains pre-configured registry v2.0 Run registry: docker run -d -p 5000:5000 registry
  • 25. Push and pull from private registry ● First tag image with host IP or domain of registry server, then run docker push Tag image and specify the registry host: docker tag <image id> localhost:5000/my-app:1.0 Push image to registry: docker push localhost:5000/my-app:1.0 Pull image from registry: docker pull localhost:5000/my-app:1.0