<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Beyza</title>
    <description>The latest articles on DEV Community by Beyza (@byzkles).</description>
    <link>https://dev.to/byzkles</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F839551%2F3aea5bd8-76e0-4392-8425-0094825f6bfe.jpeg</url>
      <title>DEV Community: Beyza</title>
      <link>https://dev.to/byzkles</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/byzkles"/>
    <language>en</language>
    <item>
      <title>Grafana and Prometheus Setup on Ubuntu 22.04</title>
      <dc:creator>Beyza</dc:creator>
      <pubDate>Sun, 10 Dec 2023 12:31:48 +0000</pubDate>
      <link>https://dev.to/byzkles/grafana-and-prometheus-setup-on-ubuntu-2204-i71</link>
      <guid>https://dev.to/byzkles/grafana-and-prometheus-setup-on-ubuntu-2204-i71</guid>
      <description>&lt;p&gt;This tutorail will show you how you can create a Grafana Server and how to download Grafana agents and Prometheus to your servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start Prometheus Main server
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;wget https://github.com/prometheus/prometheus/releases/download/v2.48.0/prometheus-2.48.0.linux-amd64.tar.gz&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;tar xvfz prometheus-*.tar.gz&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;cd prometheus-*-amd64/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;screen -S prometheus&lt;/code&gt; =&amp;gt; creates a new screen in you server&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update prometheus yaml file:&lt;br&gt;
&lt;code&gt;nano /prometheus-2.48.0.linux-amd64/prometheus.yml&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=&amp;lt;job_name&amp;gt;` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

  # configs for scraping node exporter metrics
  - job_name: node
    static_configs:
      - targets: ['localhost:9100']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;./prometheus --config.file=prometheus.yml&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;http://public ip:9090/metrics&lt;/code&gt; You should be able to see Prometheus metrics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Use Ctrl a+d = go to main screen)&lt;/p&gt;

&lt;h2&gt;
  
  
  Download Node exporter:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;screen -S node-exporter&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tar xvfz node_exporter-*.*-amd64.tar.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd node_exporter-*.*-amd64&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./node_exporter&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;http://&amp;lt;public ip&amp;gt;:9100/metrics&lt;/code&gt; Prometheus metrics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Ctrl a+d = Go to main screen)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Grafana
&lt;code&gt;sudo yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-9.5.2-1.x86_64.rpm sudo systemctl start grafana-server.service&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is your Grafana server: &lt;code&gt;http://public ip:3000/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Setup your admin name and pass&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Username: admin&lt;/li&gt;
&lt;li&gt;Password: mypass&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: &lt;code&gt;service grafana-server restart&lt;/code&gt; = If you make any changes to the main server's configuration, be sure to run this command afterwards.&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://prometheus.io/download/"&gt;prometheus.io/download/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://grafana.com/grafana/download"&gt;grafana.com/grafana/download&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The upcoming tutorials will cover the topics of creating dashboards, alerting systems, and integrating with Slack.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Create ELK Kibana Watcher and Send Email Reports as PNG</title>
      <dc:creator>Beyza</dc:creator>
      <pubDate>Thu, 07 Dec 2023 12:41:31 +0000</pubDate>
      <link>https://dev.to/byzkles/create-elk-kibana-watcher-and-send-email-reports-as-png-3pg5</link>
      <guid>https://dev.to/byzkles/create-elk-kibana-watcher-and-send-email-reports-as-png-3pg5</guid>
      <description>&lt;p&gt;A tutorial on the process of sending a Kibana dashboard to email addresses as a (PNG) image is not readily available. After extensive experimentation and research, I have produced a comprehensive guide on this topic. The tutorial outlines the step-by-step instructions for this task, and will provide a much-needed resource for those interested in achieving this objective.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;code&gt;Your account/Contacts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add your email here
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SymW0SsJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30zuvbizvioq57pxvic4.png" alt="Image description" width="800" height="654"&gt;
&lt;/li&gt;
&lt;li&gt;Confirm the email coming from Elastic.&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;Stack Manager &amp;gt; Watcher&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;new Watcher&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Edit yout watch&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "trigger": {
    "schedule": {
      "interval": "24h"
    }
  },
  "input": {
    "none": {}
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "email_admin": {
      "email": {
        "profile": "standard",
        "attachments": {
          "error_report.png": {
            "reporting": {
              "url": "reporting-url (1)",
              "interval": "260s",
              "auth": {
                "basic": {
                  "username": "user (2)",
                  "password": "passw (3)"
                }
              }
            }
          }
        },
        "to": [
          "'me &amp;lt;me@mail.com&amp;gt;, you &amp;lt;you@mail.com&amp;gt;'"
        ],
        "subject": "Monitoring Report"
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are some fields that you need to fill:&lt;/p&gt;

&lt;p&gt;STEP (1)&lt;br&gt;
Go one of your dashboards&lt;br&gt;
Click &lt;code&gt;Share &amp;gt; PNG Reports &amp;gt; Advanced Options &amp;gt; Copy Post Url&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c7VewH8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn7t23jmkk8299via7jc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c7VewH8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn7t23jmkk8299via7jc.png" alt="Image description" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;STEP (2) and (3)&lt;br&gt;
Create user with privileges,&lt;br&gt;
go to: &lt;code&gt;management/security/users&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create a user&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TkgZIVF0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9qqcdo5eiq4jm3excjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TkgZIVF0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9qqcdo5eiq4jm3excjz.png" alt="Image description" width="800" height="696"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(UTC timezone)&lt;/p&gt;

&lt;p&gt;Save your watcher and exit to main page. That way you will get PNG reports to your email everyday.&lt;/p&gt;

&lt;p&gt;Main Source:&lt;br&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/trigger-schedule.html"&gt;https://www.elastic.co/guide/en/elasticsearch/reference/current/trigger-schedule.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>kibana</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>basic docker commands #class-notes</title>
      <dc:creator>Beyza</dc:creator>
      <pubDate>Tue, 26 Apr 2022 15:46:39 +0000</pubDate>
      <link>https://dev.to/byzkles/basic-docker-commands-class-notes-fdg</link>
      <guid>https://dev.to/byzkles/basic-docker-commands-class-notes-fdg</guid>
      <description>&lt;h1&gt;
  
  
  Container Logic
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Without containerizing:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--em_ODyCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp2a5mmkgxfrte554q3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--em_ODyCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp2a5mmkgxfrte554q3a.png" alt="Without containerizing" width="880" height="483"&gt;&lt;/a&gt;&lt;br&gt;
src:&lt;a href="https://www.youtube.com/watch?v=4XVfmGE1F_w"&gt;kablosuzkedi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With containerizing:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gJv3mnt2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlzanl5iu6eppx1lp2qw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gJv3mnt2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlzanl5iu6eppx1lp2qw.png" alt="With containerizing" width="880" height="707"&gt;&lt;/a&gt;&lt;br&gt;
src: &lt;a href="https://www.youtube.com/watch?v=4XVfmGE1F_w"&gt;kablosuzkedi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE: &lt;a href="https://hub.docker.com/"&gt;https://hub.docker.com/&lt;/a&gt; -&amp;gt; The holy documentation.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Commands&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker pull ubuntu |or| docker run ubuntu&lt;br&gt;
$ docker pull mongo&lt;br&gt;
$ docker run redis&lt;/code&gt;&lt;br&gt;
…&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It pulls ubuntu/mongo/redis from dockerhub. docker run controls the local to check if exists, if not it installs it on docker hub.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker images&lt;/code&gt;&lt;br&gt;
shows the installed images  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker run  -it  ubuntu&lt;/code&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;opens the ubuntu terminal (-it means interactive terminal)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker ps&lt;br&gt;
$ docker ps -a&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this commands shows which container(s) are active right now.&lt;/li&gt;
&lt;li&gt;-a refers to “all” and it shows all containers which were active before (it also shows active ones too). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker  run  -it  -- name   my_terminal   ubuntu&lt;/code&gt;&lt;br&gt;&lt;br&gt;
renames ubuntu to my_terminal (!. double - - before name)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker run  -it   my_terminal&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;now the terminal can use this name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker start  my_terminal&lt;br&gt;
$ docker stop   my_terminal&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;starts and stops terminals in the background.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker stop e7g&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Container ID also can use instead of the name, same thing happens (the Container ID can learn by docker ps -a command).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker rm my_terminal&lt;br&gt;
$ docker rm e7g&lt;br&gt;
$ docker rm  eg7  gh4  77v  22w  fg4  #for multiple containers &lt;br&gt;
$ docker container rm $(docker container ls -aq) #for all containers&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;removes the specific container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker run -d mongo&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;detach mode works in the background.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker container logs g87dw&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;shows logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker run -it user/lets-meet-app&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if there is an interactive app wanted to use, -it flag must be written (otherwise it will just print the code). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker inspect ubuntu&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prints its attributes.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Port Mapping&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker run -p 3000:3000 node #or another custom app, user/my-app&lt;br&gt;
$ docker run -p 3001:3000 node&lt;br&gt;
$ docker run -p 3002:3000 node&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Now the app can use on port 3000, 3001, 3002 (host:container).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;#try localhost:3000 , localhost:3001 and localhost:3002 … Same result.&lt;/code&gt; &lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Volume Mapping and Connecting Containers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;= Notes =&lt;/em&gt;&lt;br&gt;
• Containers work as a process (like downloaded Spotify, MS Word…)&lt;br&gt;
• Host containers work stateless… So they don't record or save any data on them. When the container stops all info will be gone forever… To prevent this situation, volumes are used.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker volume create first-volume&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;creates a volume&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker container run -it -v first-volume:/sample alpine sh&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the first field is the name of the volume (first-volume). The second field is the path where the file or directory are mounted in the container (/sample)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A simple exercise for volume mapping&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume create my-volume
docker container run -it -v my-volume:/sample alpine sh
cd sample
echo "hello from the first container" &amp;gt;&amp;gt; file1.txt
exit
docker container rm &amp;lt;ContainerId&amp;gt;

docker volume inspect my-volume
cd /var/lib/docker/volumes/my-volume/_data
cat file1.txt

or

docker container run -it -v first-volume:/try1 alpine sh
cd try1
cat file1.txt

touch file2.txt
echo "hello from the second container" &amp;gt;&amp;gt; file2.txt
exit

docker container run -it -v first-volume:/try2 ubuntu sh
cd try2
ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;$ docker run     --name   mysql-server   -v  /opt/data:/etc/mysql/conf.d     -p  3306:3306      -e MYSQL_ROOT_PASSWORD=test147  -d mysql&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-e stands for: env variable, -p: for port, - -name : for rename, -v : volume.
MYSQL_ROOT_PASSWORD is necessary for the password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker rmi redis&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rmi = remove image, removes images.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Networking in Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are 3 basic network drivers in Docker, but the most common use is the bridge network. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker network ls&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EtvTnGeD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7sucev5xatc26gtfr7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EtvTnGeD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7sucev5xatc26gtfr7w.png" alt="Image description" width="322" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker run -it -d -- name cont1 alpine ash&lt;br&gt;
$ docker run -it -d -- name cont2 alpine ash&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run 2 containers with alpine image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker network inspect bridge&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;shows the details of the bridge network.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker inspect cont2 | grep IPAddress&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;getting the ip address of cont2.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f7LtAmRO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01t216n6xidoafamkp17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f7LtAmRO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01t216n6xidoafamkp17.png" alt="Image description" width="880" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker attach cont1&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;attaching containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ ping -c 5 &amp;lt;cont2 ip address&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-c is stand for 5 hops.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LczbJFhB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2gouhlsc1kunqw6pcj8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LczbJFhB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2gouhlsc1kunqw6pcj8.png" alt="Image description" width="880" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;! Note&lt;br&gt;
If we try to ping the 2nd container by name, it will give a "bad address" error because default bridge network containers can only communicate with their IP addresses.. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ docker stop cont1 cont2&lt;br&gt;
$ docker rm con1 cont2&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stops and removes containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker network create --driver bridge mynet&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;creates a network bridge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ docker network connect mynet cont3&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;connects a container to my network&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Docker Compose
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose. &lt;a href="https://docs.docker.com/compose/"&gt;Docs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Example usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;docker-compose.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3.9"  # optional since v1.27.0
services:
  web:
    build: .
    ports:
      - "8000:5000"
    volumes:
      - .:/code
      - logvolume01:/var/log
    links:
      - redis
  redis:
    image: redis

volumes:
  logvolume01: {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;$ docker compose up&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;starts and runs the app.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Plus: Dockerfile&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Dockerfile example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM python:alpine
COPY . /app
WORKDIR /app 
RUN pip install -r requirements.txt
EXPOSE 80
CMD python ./app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;$ docker build -f /path/to/a/Dockerfile .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/engine/reference/builder/"&gt;Docs&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Note for AWS VM users:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instead of using sudo every command, write these.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo usermod -a -G docker ec2-user&lt;br&gt;
$ newgrp docker&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/reference/commandline/rm/"&gt;https://docs.docker.com/engine/reference/commandline/rm/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=ZeYIp1PrWXc&amp;amp;t=730s"&gt;https://www.youtube.com/watch?v=ZeYIp1PrWXc&amp;amp;t=730s&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Clarusway pre-classes -&amp;gt; &lt;a href="https://clarusway.com/"&gt;https://clarusway.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>docker</category>
      <category>cloudskills</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
