Docker Deep Dive

The slides

will explore

  • What is docker

  • How to use docker

  • Where to find base image

  • Docker basic command

  • Docker registry

What is docker?

Subtitle

PACKAGE YOUR APPLICATION INTO A STANDARDIZED UNIT FOR SOFTWARE DEVELOPMENT

This guarantees that the software will always run the same, regardless of its environment.

Benefit?

DOCKER ELIMINATE ENVIRONMENT INCONSISTENCIES

How to use docker ?

What are the requirement?

Thats it..

Where to find the base image..

https://hub.docker.com

https://store.docker.com

The image often come with documentation

Dockerfile

Dockerfile enable you to modify the base image

Example of dockerfile

#----------Get image from kartoza/geoserver----------
FROM kartoza/geoserver

#----------Copy and add resource folder to the path of tomcat----------ADD resources /usr/local/tomcat/webapps/ROOT/

Docker build

step to build an image

  1. Change to the dockerfile directory
  2. docker build -t image_name .
  3. docker build -t gds/geoserver .

Docker basic command

Lets take a look

Docker basic command

Command Description
Docker ps see all running container
Docker ps -a See all container
Docker images see all available image
Docker diff container_name See changes from initial run

Docker run command

Command Example
docker run --name "container_name"  -d --restart=always -p host_port:container_port -t image_name  docker run --name “postgis” -d --restart=always -p 5432:5432 -t gds/postgis

Docker commit changes

Command Example
docker commit  container_name repository:tag docker commit geoserver gds/geoserver:version1

Docker ssh and run bash on container

Command Example
sudo docker exec -i -t container_name /bin/bash sudo docker exec -i -t geoserver /bin/bash

Docker remove container

Command Description
docker rm -f container_name To force remove running container
docker rm container_name remove container that are not running

Docker remove images

Command Example
docker rmi image_name docker rmi gds/geoserver

Docker Registry

The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. The Registry is open-source, under the permissive Apache license.

For easy understanding

Docker registry is almost similar to gitlab

Why use it

You should use the Registry if you want to:

 

  • tightly control where your images are being stored
  • fully own your images distribution pipeline
  • integrate image storage and distribution tightly into your in-house development workflow

Since the registry need a SSL and we dont have it, so there is a workaround and some configuration need to be done in order to make it work.

Docker push an image

  • docker tag image_name ip_address:5000/new_name
  • docker push ip_address:5000/new_name
  • ssh quraisyah@192.168.0.9   
  • [password:password]
  • docker pull ip_address:5000/new_name
  • docker images
  • exit

Thanks

Made with Slides.com