Nisan, 2018 tarihine ait yayınlar gösteriliyor

Docker Terminology

let’s clarify some terminology that is used frequently in the Docker ecosystem. Images   - The file system and configuration of our application which are used to create containers. To find out more about a Docker image, run  docker image inspect alpine .  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. You created a container using  docker run  which you did using the alpine image that you downloaded. A list of running containers can be seen using the  docker container ls  command. 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. Docker Store  - Store is, among other things, a  registry  

Docker - Review

Docker Open platform that make deployment easier, faster & more reliable using standarized container technology Docker Image: Abstraction of lightweight, stand-alone, executable package of a pice of software that includes everyting needed to run. To view all of your image use: # docker images Docker Container: Runtime environment generated based of docker images, each image can be used to create multiple exact replica of docker contrainers. Made you easier to deploy similiar environment in a matter of seconds . To view all of your your container use: # docker ps Docker Compose: Docker feature that enable you to create "template" of multiple difference service deployment in a single execution

Demo: Deploying Simple Micsoservices With Docker Compose

- Create the project directory #mkdir simple-wordpress -Install docker compose #yum -y install docker-compose -Create the following compose file as "docker-compose.yml" version: '2'    ---> compose file format version services:    ---> defining one or multiple services definition    db:       image: mysql:5.7   ---> image to be run by the service        volumes:         - db_data: var/lib/mysql  --> volume to be used by services        restart: always       environment:            MYSQL_ROOT_PASSWORD: somewordpress            MYSQL_DATABASE: wordpress            MYSQL_USER:    wordpress            MYSQL_PASSWORD: wordpress    web:        --->service name        depends_on:           -db        image: wordpress:latest                 restart: always         ports:     --> expose ports to the host            - "8000:80"        environment:            WORDPRESS_DB_HOST: db:3306            WORDPRESS_DB_HOST: wordpress    

Docker Compose

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration. Docker Compose Use Case When you're developing software, the ability to run an application in an isolated environment and interact with it is crucial. The Compose file provides a way to document and configure all of the application's service dependencies (databases,queues, caches, web service APIs,etc) Docker Compose Quickstart There are 3 step process: 1- Define your app's environment with a Dockerfile so it can be reproduced anywhere. 2- Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment. 3- Run docker-compose up and Compose will start and run your entire app. Docker compose file example version: '3'   ---> compose file format ve

Docker Volume

It is possible to store data within the writable layer of a container, but there are some downsides: The data won't persist when that container is no lunger running. A container's writable layer is tightly coupled to the host machine where the container is running. Writing into a container's writable layers requires a storage drive to manage the filesystem. the storage driver provides a union filesystem, using the Linuz kernel. -Stop the running container # docker stop nginx nginx is the container name that had assigned before. -Run new container with volume # docker run -d --name nginx-persistent -v nginx-volume:/usr/share/nginx/html/ -p 8080:80 custom-nginx -Create & Modify some file on the mounter volume # echo "this is created in a persistent volume" > /var/lib/docker/volumes/nginx-volume/_date/index.html -remove & recreate the container to verify the mounted data is persistent


Dockerfile is a text document that containes all the commands a user could call on the command line to assemble an image. Using docker build users can create ana automated build that executes several command-line instructions in succession. Whenever possible, Docker will reuse the intermediate images(cache), to accelerate the docker build process significantly. Here is the format of the Dockerfile: # Comment INSTRUCTION arguments A Dockerfile must start with a "FROM" instruction FROM  -> Used to specify the base image from your custome image USER   -> User that will run the container ADD    -> Copy some file in your current directory into some dir inside the image EXPOSE -> informs Docker that the container listens on the specified network ports at runtime RUN  -> run some commands in the container CMD -> command that will be executed when the container started WORKDIR -> The working directory of the running container ENV -> Inject som

Installation & Deploying Your First Container

- Installing Docker # yum -y install docker -Enabling & Starting docker service #systemctl enable docker #systemctl start docker -Testing the installation using test container #docker run hello-world