Kayıtlar

docker etiketine sahip yayınlar gösteriliyor

Deploy and config NGINX on Angular 7 + Nginx Docker

Create and run docker image docker run --name app-nginx -p 9595:80 -v /media/storage/angular7nginx-app/:/usr/share/nginx/html:ro -d nginx Go to docker image docker exec -ti app-nginx /bin/bash vim /etc/nginx/nginx.conf Add these line of code inside the http Restart docker container Check docker logs docker logs app-nginx app-nginx is application name server {     listen 80;     listen [::]:80;     server_name http://ip;     root /usr/share/nginx/html;     index index.html index.htm;     location / {         try_files $uri $uri/ /index.html; # This will allow you to refresh page in your angular app. Which will not give error 404.     } } usefull commands on docker: docker commit app-nginx nginx:latest  --> create a new docker with latest tag docker logs app-nginx -f                       ...

Docker File System Exploration

We will now have a look inside the  /var/lib/docker/overlay2  folder where the image and container layers are stored. ls /var/lib/docker/overlay2 As we do not have any images yet, there should not be anything in this folder. Let’s pull an nginx image docker image pull nginx You should get something like the following where we can see that 3 layers are pulled. Using default tag: latest latest: Pulling from library/nginx 5040bd298390: Pull complete d7a91cdb22f0: Pull complete 9cac4850e5df: Pull complete Digest: sha256:33ff28a2763feccc1e1071a97960b7fef714d6e17e2d0ff573b74825d0049303 Status: Downloaded newer image for nginx:latest If we have a look to the changes that occurs in the /var/lib/docker/overlay2 folder ls /var/lib/docker/overlay2 we can see the following: 261fed39e3aca63326758681c96cad5bfe7eeeabafda23408bee0f5ae365d3fd 28f7998921ca5e4b28231b59b619394ba73571b5127a9c28cc9bacb3db706d2a backingFsBlockDev c1ae1be1c1c62dbaacf26bb9a5cde02e30d5364e06a437d0...

Play With Docker

-download cassandra docker image docker pull cassandra docker image pull cassandra docker container run cassandra docker run -ti cassandra /bin/sh -run cassandra docker image docker run -d cassandra -d -> run container in background and print container ID docker run --name cass1 -d cassandra --name -> set container name first machine docker run --name cass1 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.42 -p 7000:7000 cassandra second machine docker run --name cass2 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.43 -p 7000:7000 -e CASSANDRA_SEEDS=192.168.10.42 cassandra BACKUP DOCKER IMAGE To backup docker images, use the docker save command that will produce a tar archive that can be used later on to create a new docker image with the docker load command. docker save cassandra > cassandra-docker-image-backup.tar BACKUP DOCKER CONTAINER You can backup a docker container by different means; -by committing a new docker image based on the docker container cur...

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 Sto...

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    ...

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...

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