## Uvod

- Docker je platforma za development, delivery i izvršavanje aplikacija
- Docker omogućava da se aplikacija izolira u repetativnoj okolini i odvoji od infrastrukture

[Features of Docker](https://www.geeksforgeeks.org/features-of-docker/):
- Open-source platform
- An Easy, lightweight, and consistent way of  delivery of applications
- Fast and efficient development life cycle
- Segregation of duties
- Service-oriented architecture
- Security
- Scalability
- Reduction in size
- Image management
- Networking
- Volume management


## Struktura

- Dockerfile
- image
- container registry
	- lokalni
	- dockerhub
	- AWS ECR
- container


## Dockerfile

- base image
	- odabir najmanjeg funkcionalnog
	- debian prije ubuntua
	- debian-slim prije debiana
	- alpine
	- from scratch
- env varijable


## Docker image

- single stage build
- multistage build


## Docker container

run, publish port 3000:
```
docker run --name api-server-3000 --publish 3000:3000 --env CONTAINER_NAME="Awesome API server on port 3000" -d api-server
```

run, publish port 3001:
```
docker run --name api-server-3001 --publish 3001:3000 --env CONTAINER_NAME="Awesome API server on port 3001" -d api-server
```
run, publish port 3002:
```
docker run --name api-server-3002 --publish 3002:3000 --env CONTAINER_NAME="Awesome API server on port 3002" -d api-server
```

# Media

## Docker vs VM

![Docker vs VM](media/docker-vs-vm.svg)

## Docker elements

![Docker elements](media/docker-elements.svg)

## Dockerfile layers

![Dockerfile layers](media/dockerfile-layers.svg)

## Port publishing

![Port publishing](media/port-publishing.svg)

## Horizontal scaling

![Horizontal scaling](media/horizontal-scaling.svg)

## Volumes

![Volumes](media/volumes.png)
