<?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: Tomislav Kraljic</title>
    <description>The latest articles on DEV Community by Tomislav Kraljic (@tomislavkraljic).</description>
    <link>https://dev.to/tomislavkraljic</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%2F573877%2Fbb595510-ea5c-4e79-aceb-6dc4c3cd4f7e.jpeg</url>
      <title>DEV Community: Tomislav Kraljic</title>
      <link>https://dev.to/tomislavkraljic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tomislavkraljic"/>
    <language>en</language>
    <item>
      <title>Switches, Hubs, Bridges, and VLAN's</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Mon, 26 Jul 2021 02:10:58 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/switches-hubs-bridges-and-vlan-s-2m1g</link>
      <guid>https://dev.to/tomislavkraljic/switches-hubs-bridges-and-vlan-s-2m1g</guid>
      <description>&lt;p&gt;&lt;em&gt;In this article, I will go over switches, hubs, and bridges. I will explain what these devices are, how they work, use-cases and advantages and disadvantages. I will also explain what a VLAN is, how it works and why we would use them&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;Hub&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sd1yDpPk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vc3j4whr0dtyhjamu19h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sd1yDpPk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vc3j4whr0dtyhjamu19h.jpg" alt="Hub Device"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is a networking device that connects PC's to a single network. &lt;/li&gt;
&lt;li&gt;This stores multiple ports, so when a packet arrives at one port, every other port also receives it.&lt;/li&gt;
&lt;li&gt;This uses the Bus Topology Network as seen below.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PFnZeKFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/461lcmwygig2eyom3yy7.png" alt="Bus Topology"&gt;
&lt;/li&gt;
&lt;li&gt;If Computer 1 sends data to Computer 2, Computer 3, 4, and 5 will also receive that data. &lt;/li&gt;
&lt;li&gt;This is commonly used in LAN(Local Area Networks) like in an office or campus.&lt;/li&gt;
&lt;li&gt;This device is half-duplex. This means that PC's can not send and receive data at the same time. If this does happen, this would cause a collision. &lt;/li&gt;
&lt;li&gt;This operates on the Physical Layer, also known as Layer 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;How Does A Hub Work?&lt;/h2&gt;

&lt;p&gt;The implementation of a hub is fairly straight-forward. &lt;/p&gt;

&lt;p&gt;Let's say you have a 5 PC's that you want to connect to the network. &lt;/p&gt;

&lt;p&gt;You would plug each PC with a ethernet cable into the port of the hub. &lt;/p&gt;

&lt;p&gt;Once, you plugged them all in, they can communicate to each and every one of the PC's connected to the switch. &lt;/p&gt;




&lt;h1&gt;Switch&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l1PsyXk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1tb08rbriapbxertbv69.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l1PsyXk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1tb08rbriapbxertbv69.jpg" alt="Switch Device"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is a networking device that connects various devices to a single computer network.&lt;/li&gt;
&lt;li&gt;This is commonly used in LAN (Local Area Network) as well!&lt;/li&gt;
&lt;li&gt;Operates in Data Link Layer, or also known as Layer 2.&lt;/li&gt;
&lt;li&gt;Maintains a MAC Address Table of each device. &lt;/li&gt;
&lt;li&gt;Uses Frames and Packets&lt;/li&gt;
&lt;li&gt;Commonly used in SOHO(Small Office/Home Office) as well!&lt;/li&gt;
&lt;li&gt;Uses Full Duplex. This means each device can send and receive at the same time.&lt;/li&gt;
&lt;li&gt;Uses the star topology network as seen below.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_7nxznyc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfh34gj5egcqjnb9ef8p.jpg" alt="Star Topology Network"&gt;
&lt;/li&gt;
&lt;li&gt;The big difference between a switch and a hub, is that when PC1 sends data to PC2, only PC2 will get it. No other devices on the network will receive that data. &lt;/li&gt;
&lt;li&gt;This is super important because if that data is sensitive, we don't want anyone else to see it as well.&lt;/li&gt;
&lt;li&gt;Switches also allow for VLANS (Virtual Local Area Networks)&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;Bridge&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tKG_Vrv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w8bv4jit3bbrz584u4jy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tKG_Vrv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w8bv4jit3bbrz584u4jy.png" alt="Bridge Device"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bridges are used to connect two or more subnetworks. &lt;/li&gt;
&lt;li&gt;&lt;p&gt;It combines two LAN's to form an extended LAN.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iLewthtG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3ivb567dltx9pae8lyc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iLewthtG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3ivb567dltx9pae8lyc.jpg" alt="Bridge"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It stores all the MAC Addresses of each device into a table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When PC1 sends data over to PC2, it will first go to the bridge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The bridge will determine which MAC Address it needs to go to and it will send it to the appropriate one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is used to reduce network traffic and increase performance because the LAN is now divided into segments.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;VLAN&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VLAN (Virtual Local Area Network) is when you break up a LAN into smaller subnetworks. &lt;/li&gt;
&lt;li&gt;This can be accomplished by using a Switch or Router.&lt;/li&gt;
&lt;li&gt;VLAN's are great for security as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wpxa4AZU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vudnbvwfi1xw5k54t3gm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wpxa4AZU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vudnbvwfi1xw5k54t3gm.png" alt="VLAN Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How Does This Work?&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Imagine we are using a LAN at an office. &lt;/li&gt;
&lt;li&gt;There are several departments: Sales, Management, 
Engineering, Marketing, Etc.&lt;/li&gt;
&lt;li&gt;We do not want the Sales department to know about any 
network traffic or data flowing inside the Engineering 
Department. That is only for Sales. It could have 
sensitive data as well that only Sales should know 
about. &lt;/li&gt;
&lt;li&gt;This is where we break the LAN up. &lt;/li&gt;
&lt;li&gt;We can designate 5 ports for Sales, 3 Ports for 
Engineering, 7 ports for Management and 2 ports for 
Marketing.&lt;/li&gt;
&lt;li&gt;Each department basically is within it's own "virtual" 
network. It's like they have their own independent 
network that no one else can see. &lt;/li&gt;
&lt;li&gt;This is the idea behind VLAN's. &lt;/li&gt;
&lt;li&gt;This also reduces network traffic. You do not want to 
see traffic from every single department. &lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;I hope this article has helped you in understanding these various network devices and how they work along with VLAN. If you have any questions, comments, or concerns, please feel free to let me know!&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>             TCP vs UDP </title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Sun, 25 Jul 2021 00:40:32 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/tcp-vs-udp-4ik</link>
      <guid>https://dev.to/tomislavkraljic/tcp-vs-udp-4ik</guid>
      <description>&lt;p&gt;&lt;em&gt;In this article, I will go over what TCP and UDP are, the differences between them, use-cases for each, how they work and the three-way handshake.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To understand TCP and UDP, we need to first understand what the Internet Protocol Suite is. &lt;/p&gt;

&lt;p&gt;In Short, the Internet Protocol Suite is a collection of different protocols that the internet uses so devices can talk to one another. &lt;/p&gt;

&lt;p&gt;TCP and UDP are two major protocols that the internet uses. Some other protocols within the Internet Protocol Suite that you may have heard of include: FTP (File Transfer Protocol), SMTP (Simple Mail Transport Protocol), and HTTP (Hyper Text Transfer Protocol). &lt;/p&gt;

&lt;p&gt;Now, lets learn about TCP and UDP!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;TCP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP stands for Transmission Control Protocol&lt;/li&gt;
&lt;li&gt;It is the most common protocol used on the internet to
transmit data&lt;/li&gt;
&lt;li&gt;It is extremely reliable and guarantees that data will 
be transferred.&lt;/li&gt;
&lt;li&gt;Has error-recovery features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When Is TCP Used?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP is used in situations where it is necessary that all data being sent is received by another device and it is guaranteed to do so.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How does TCP Work?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;TCP is a connection-based protocol. This means that a connection is established between two devices before transferring data and maintains it throughout the transfer process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To establish a connection between two devices, a three way handshake is initiated between the client and server.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0mXtAJ4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/86vjauo3jc9xxe0brlgf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0mXtAJ4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/86vjauo3jc9xxe0brlgf.png" alt="TCP Three Way Handshake"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, to read this article, your device, which could be a smartphone, tablet, or laptop will send a message to the server of this site. &lt;/p&gt;

&lt;p&gt;This message is called a Synchronized Sequence Number (SYN).&lt;/p&gt;

&lt;p&gt;Then, the message will get to the server and the server will acknowledge that the message was sent and received. It will send back an acknowledgement back to the client machine called SYN-ACK. &lt;/p&gt;

&lt;p&gt;Then, the client machine will receive that SYN-ACK message from the server and send back a ACK (acknowledgement) message, resulting in a connection being established. &lt;/p&gt;

&lt;p&gt;Once this connection is established, the protocol guarantees all data will be transmitted. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does TCP Do Error Recovery?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP has a mechanism called Windowing to control the flow of data.&lt;/li&gt;
&lt;li&gt;A Window is the amount of data that can be sent before an ACK message is received. &lt;/li&gt;
&lt;li&gt;The ACK message will have a forward looking acknowledgment number with the next expected data segment. &lt;/li&gt;
&lt;li&gt;If this is wrong, the client will sent back the lost/dropped data segment back to the server before moving forward. &lt;/li&gt;
&lt;li&gt;This will ensure no data is forgotten or lost.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;UDP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UDP stands for User Datagram Protocol&lt;/li&gt;
&lt;li&gt;Less reliable than TCP but lighter and faster.&lt;/li&gt;
&lt;li&gt;Has way less features than TCP.&lt;/li&gt;
&lt;li&gt;Does not care if data was sent successfully or not&lt;/li&gt;
&lt;li&gt;Known as "fire and forget" protocol&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When is UDP Used?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UDP is used for situations when data loss is acceptable and performance is highly criticle.&lt;/li&gt;
&lt;li&gt;Great examples include: Online Gaming, Live Video/Audio, VoiP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How does UDP Work?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UDP is a connection-less protocol. This means that no connection is established beforehand, unlike TCP with the three-way handshake.&lt;/li&gt;
&lt;li&gt;UDP will just send the data segments. It doesn't care if the server actually receives it and it doesn't do any error recovery either. This is why it is called the "fire and forget" protocol. &lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>What is Cloud Computing?</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Tue, 06 Jul 2021 05:44:10 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/what-is-cloud-computing-469c</link>
      <guid>https://dev.to/tomislavkraljic/what-is-cloud-computing-469c</guid>
      <description>&lt;p&gt;In this article, I will explain what Cloud Computing is, and the differences between Cloud Providers and On-Premise. &lt;/p&gt;

&lt;h3&gt;
  
  
  What is Cloud Computing?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The practice of using a network of remote servers hosted on
internet to store, manage, and process data, rather than on 
a local server on a personal computer.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  On Premise vs Cloud Providers
&lt;/h3&gt;

&lt;p&gt;Before Cloud Computing existed, you had to have your own servers, data centers, maintain them physically, hire people to rack, stack and power those servers. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Premise&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; You own the servers. &lt;/li&gt;
    &lt;li&gt; You hire the IT people. &lt;/li&gt;
    &lt;li&gt; You pay for the real-estate. &lt;/li&gt;
    &lt;li&gt; You assume all the risk. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cloud Providers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With Cloud Computing, you pay the cost of utilizing a cloud provider and they do all the work for you! It's amazing, isn't it? &lt;/p&gt;



&lt;ul&gt;

   &lt;li&gt;Someone else owns the servers. &lt;/li&gt;

   &lt;li&gt; Someone else hires the IT people. &lt;/li&gt;

   &lt;li&gt; Someone else pays for the real-estate. &lt;/li&gt;

   &lt;li&gt; You are only responsible for configuring the cloud 
        services and the code that you deploy. Everything 
         else is handles by someone else. &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>How To Configure and Run Nexus OSS on a Remote Server</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Mon, 28 Jun 2021 02:07:35 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/how-to-configure-and-run-nexus-oss-on-a-remote-server-o9p</link>
      <guid>https://dev.to/tomislavkraljic/how-to-configure-and-run-nexus-oss-on-a-remote-server-o9p</guid>
      <description>&lt;p&gt;In this tutorial, I will teach you the two ways to configure/run the Nexus Repository Manager on a remote server.&lt;/p&gt;

&lt;p&gt;For the remote servers, I will be using Digital Ocean. &lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Running Nexus Directly on Server
&lt;/h3&gt;

&lt;p&gt;1) First, we want to create our remote server on Digital Ocean. &lt;/p&gt;

&lt;p&gt;2) Configure the Firewall Rules as such: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ulMTedQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2uewlk2uxmwhfjduofxa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ulMTedQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2uewlk2uxmwhfjduofxa.png" alt="Firewall Rules"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do not forget to add the droplet to the firewall as well. &lt;/p&gt;

&lt;p&gt;3) SSH into your remote server through the terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh root@&amp;lt;ipv4_address&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4) Update the package manager&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;5) Change directories into opt&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /opt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;6) Get the Nexus OSS tar file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;7) Untar the file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -zxvf latest-unix.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;8) Create a new user because we do not want to run a service as root.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adduser nexus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;9) Grant ownership of Nexus folders/files to the new user&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown -R nexus:nexus nexus-3.28.1-01
chown -R nexus:nexus sonatype-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10) Open nexus.rc and add the new user you created&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vim nexus-3.28.1-01/bin/nexus.rc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;11) Uncomment and add the user inside the quotes and exit.&lt;/p&gt;

&lt;p&gt;12) Switch to new user&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su - nexus (or whatever you named the new user)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;13) Start Nexus&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/opt/nexus-3.28.1-01/bin/nexus start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;14) Enter the IPv4 address of the remote server you created and add the port in the URL search bar.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;ipv4_address&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Congratulations! You have successfully configured Nexus on your remote server!&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Running Nexus Repository Manager via Docker
&lt;/h3&gt;

&lt;p&gt;1) Pull the image from DockerHub&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull sonatype/nexus3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2) Create a volume&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume create --name nexus-data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3) Run the image in a container&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p 8081:8081 --name nexus-data -v nexus-data:/nexus-data sonatype/nexus3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4) Enter the IPv4 address of the remote server you created and add the port in the URL search bar.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ipv4_address&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Congratulations! You have successfully started Nexus on your remote server using Docker!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
    </item>
    <item>
      <title>How IP Addresses Work</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Thu, 24 Jun 2021 21:49:49 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/how-ip-addresses-work-jl2</link>
      <guid>https://dev.to/tomislavkraljic/how-ip-addresses-work-jl2</guid>
      <description>&lt;p&gt;&lt;em&gt;In this article, I will go over what IP addresses are, types of addresses, class-full vs class-less addresses, classes of networks, subnets and CIDR (Classless Inter-Domain Routing) notation.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an IP Address?
&lt;/h3&gt;

&lt;p&gt;In the most simplest terms, an IP (Internet Protocol) Address is a unique local address used to locate a computer/device via a network. &lt;/p&gt;

&lt;p&gt;There are two types of IP Addresses:&lt;/p&gt;

&lt;p&gt;1) IPV4 (32 bit)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;192.168.0.100 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2) IPV6 (128 bit)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FD3B:F15C:C672:34B8::100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this article, we will focus on IPV4 addresses as they are the ones most commonly used.&lt;/p&gt;

&lt;p&gt;Let's take a look at an example of an IPV4 address&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;192.168.0.100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Each number is called an &lt;code&gt;octet&lt;/code&gt; because it is an 8 bit value. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;192&lt;/strong&gt;: &lt;code&gt;1100 0000&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;168&lt;/strong&gt;: &lt;code&gt;1010 1000&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;0&lt;/strong&gt;: &lt;code&gt;0000 0000&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;100&lt;/strong&gt;: &lt;code&gt;0110 0100&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;8 bits means these number can range from 0-255.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;0&lt;/strong&gt;: &lt;code&gt;0000 0000&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;255&lt;/strong&gt;: &lt;code&gt;1111 1111&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This means an IP address starts at &lt;code&gt;0.0.0.0&lt;/code&gt; and ends at &lt;code&gt;255.255.255.255&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This range of IP addresses is called the &lt;code&gt;IP Space&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;IP Addresses are actually comprised of 2 addresses in one. &lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; Network Address &lt;/li&gt;
    &lt;li&gt; Host Address &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's take a look at an example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;176.16.0.1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;172.16&lt;/strong&gt;: Network Address&lt;br&gt;
&lt;strong&gt;0.1&lt;/strong&gt;: Host Address&lt;/p&gt;

&lt;p&gt;Is it always the first two as the network address and last two as the host address? &lt;/p&gt;

&lt;p&gt;No. It is dependent on the class of address. We will take a look at them in the following section. &lt;/p&gt;




&lt;h3&gt;
  
  
  Class-full Networking and Classes of IP Addresses
&lt;/h3&gt;

&lt;p&gt;There are a total of 5 classes: A, B, C, D, E&lt;/p&gt;

&lt;p&gt;For this article, I will only go over classes A, B, and C because they pertain to devices and are the ones most commonly used. &lt;/p&gt;

&lt;p&gt;Class A: Large Networks&lt;/p&gt;

&lt;p&gt;Range: 1.0.0.1 - 126.255.255.254&lt;/p&gt;

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

&lt;ul&gt;
    &lt;li&gt; The first number (octet) is for the network and the remaining three are for hosts. 
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt;: Network &lt;br&gt;
&lt;strong&gt;2.3.4&lt;/strong&gt;: Hosts&lt;/p&gt;

&lt;p&gt;Class B: Medium Networks&lt;/p&gt;

&lt;p&gt;Range: 128.1.0.1 - 191.255.255.254&lt;/p&gt;

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

&lt;ul&gt;
    &lt;li&gt; The first two numbers (octets) are for the network and the last two are for hosts. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Class C: Small Networks:&lt;/p&gt;

&lt;p&gt;Range: 192.0.0.1 - 223.255.254.254&lt;/p&gt;

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

&lt;ul&gt;
    &lt;li&gt; The first three numbers (octets) are for the network and the last number is for the hosts. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: You may notice that 127 is not included in these ranges. The reason is because that is a special one reserved for localhost. &lt;/p&gt;

&lt;p&gt;This was called "class-full networking". This was the architecture used from 1981 until 1993. In 1993, CIDR(Class-less Inter-Domain Routing) was invented and we switched over. &lt;/p&gt;

&lt;p&gt;Why? &lt;/p&gt;

&lt;p&gt;Well, let's take a closer look at an IP Address.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.16.0.0&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;This allows for 65,000 hosts per network. If we have a bunch of small offices, we don't need to reserve 65,000 hosts per office. That is over-kill. Thus, we switched over to class-less networking.  &lt;/p&gt;




&lt;h3&gt;
  
  
  Class-less Networking
&lt;/h3&gt;

&lt;p&gt;Class-less networking relies on sub-netting and sub-net masks instead of classes now. We abandoned class-full networking and use class-less networking instead. &lt;/p&gt;

&lt;p&gt;What is sub-netting? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sub-netting is breaking up a large network into smaller ones. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is a sub-net mask?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A sub-net mask tells us which part of the IP Address is for the network and host. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example 1:&lt;code&gt;4.3.2.1&lt;/code&gt; -&amp;gt; &lt;code&gt;255.0.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The 0's are reserved for hosts and the 255 (1) is reserved for the network. &lt;/p&gt;

&lt;p&gt;Example 2: &lt;code&gt;183.6.22.9&lt;/code&gt; -&amp;gt; &lt;code&gt;255.255.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example 3: &lt;code&gt;203.4.9.6&lt;/code&gt; -&amp;gt; &lt;code&gt;255.255.255.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With sub-netting, let's take a look at a previous IP Address used: &lt;code&gt;172.15.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.15.0.0&lt;/code&gt; would be &lt;code&gt;255.255.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This would allow for about 65,000 hosts in our network as mentioned previously. &lt;/p&gt;

&lt;p&gt;We can break our network class into something smaller using our subnet mask. &lt;/p&gt;

&lt;p&gt;So, instead of &lt;code&gt;255.255.0.0&lt;/code&gt;, it could be &lt;code&gt;255.255.255.0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This would now only allocate 256 hosts per network. That is a lot better, and more manageable than 65,000. &lt;/p&gt;




&lt;h3&gt;
  
  
  CIDR Notation
&lt;/h3&gt;

&lt;p&gt;CIDR Notation is a way for us to include the IP Address and the subnet mask. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.16.1.0/24&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/24&lt;/code&gt; is the same as &lt;code&gt;255.255.255.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This just means the first 24 bits of the subnet mask are turned on. &lt;/p&gt;

&lt;p&gt;24 / 8 = 3 (first three octets of IP Address). &lt;/p&gt;

</description>
    </item>
    <item>
      <title>How To Install NPM and Node.js in Jenkins</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Thu, 24 Jun 2021 05:06:46 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/how-to-install-npm-and-node-js-in-jenkins-4i3n</link>
      <guid>https://dev.to/tomislavkraljic/how-to-install-npm-and-node-js-in-jenkins-4i3n</guid>
      <description>&lt;p&gt;This article will be a continuation of my previous article (Configuring and Running Jenkins on a Remote Server with Docker). &lt;/p&gt;

&lt;p&gt;If you haven't read it, here is the link: &lt;br&gt;
&lt;a href="https://dev.to/tomislavkraljic/configuring-and-running-jenkins-on-a-remote-server-with-docker-1cdl"&gt;https://dev.to/tomislavkraljic/configuring-and-running-jenkins-on-a-remote-server-with-docker-1cdl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In that tutorial, I went over how to create a remote server on Digital Ocean, configuring, and run Jenkins in a Docker Container on that server. &lt;/p&gt;

&lt;p&gt;In this article, I will be teaching you how to install npm and Node.js inside a Jenkins Container. Let's get started!&lt;/p&gt;


 

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Make sure you remote server is up and running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; SSH into your remote server via the command line.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ssh root@&amp;lt;ipv4_address&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Grab the container id of Jenkins: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Enter inside the container that is running Jenkins &lt;strong&gt;as root user&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker exec -u 0 -it &amp;lt;container_id&amp;gt; bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Check Linux Distribution running in your Container&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /etc/issue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; Update APT&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt-update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt; If not already, install Curl&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt install curl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; Run curl command to get scripts to install Node.js and NPM&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 9:&lt;/strong&gt; Execute script&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash nodesource_setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 10:&lt;/strong&gt; Install Node.js and NPM&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt install nodejs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Congratulations! You successfully installed NPM and Node.js for Jenkins!&lt;/em&gt; &lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The OSI Model and How It Works</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Thu, 24 Jun 2021 03:13:28 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/the-osi-model-and-how-it-works-516j</link>
      <guid>https://dev.to/tomislavkraljic/the-osi-model-and-how-it-works-516j</guid>
      <description>&lt;p&gt;&lt;em&gt;In this article, I will go over what the OSI Model is and what each layer does along with its responsibilities.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the OSI Model?
&lt;/h3&gt;

&lt;p&gt;The OSI (Open Systems Interconnection) Model is a reference guide to how devices/computers communicate with one another across a network. &lt;/p&gt;

&lt;p&gt;It contains 7 layers. Each layer plays a crucial part in transmitting data across a network. &lt;/p&gt;

&lt;h3&gt;
  
  
  Layers of the OSI Model
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ifjQrM-y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72fyzs9eyhefjcmu5rwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ifjQrM-y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72fyzs9eyhefjcmu5rwu.png" alt="OSI Model and the 7 Layers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will go over each layer and their responsibilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 7: Application Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The application layer is the human-computer interaction layer. This is where the applications accesses the network. &lt;/p&gt;

&lt;p&gt;This would include web browsing, sending emails, file transfers. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 6: Presentation Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The presentation layer is responsible for encrypting data (if necessary), data conversion and formatting. This is where you would find file formats like pictures and videos. &lt;/p&gt;

&lt;p&gt;The application may contain lots of data that might not make sense to the rest of the network. This layer takes care of that issue. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 5: Session Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An application/program may need to talk to several endpoints. It is important to track where these "conversations" occur. Each conversation is called a &lt;em&gt;session&lt;/em&gt;. Each session is tagged with a session id as well. &lt;/p&gt;

&lt;p&gt;Ultimately, this layer will create a session between two applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 4: Transport Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The transport layer is responsible for breaking the data down into smaller chunks/blocks. We do not want to send all our data at once if there is a lot of data. Therefore, we break it up into smaller parts. Here, this layer will either use TCP or UDP. &lt;/p&gt;

&lt;p&gt;With TCP, each block is called a data segment. &lt;/p&gt;

&lt;p&gt;With UDP, each block is called a datagram. &lt;/p&gt;

&lt;p&gt;This layer decides how much data is being sent and the rate of which the data is being sent at.&lt;/p&gt;

&lt;p&gt;This layer uses port numbers to track where the data is going. Each flow of data has a port number associated with a source and destination host. These values are added to the header for each block of data. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ah3FUEYB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bywzrwtrylkkunt5cktm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ah3FUEYB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bywzrwtrylkkunt5cktm.png" alt="PDU Data Fragmentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3: Network Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The network layer is responsible for the routing and where exactly the data will be sent. It adds the source and destination IP addresses and puts that information into another header. &lt;/p&gt;

&lt;p&gt;As of now, the data has two headers (one for ports, the second for IP addresses). This is called a &lt;em&gt;packet&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;This layer does not check for errors. Essentially, it blindly sends this packet down to the Data Link Layer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2: Data Link Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This layer is responsible for getting data from once device to another by creating a logical link between devices. &lt;/p&gt;

&lt;p&gt;This layer is comprised of two sub-layers: LLC(Logical Link Control) and MAC(Media Access Control). &lt;/p&gt;

&lt;p&gt;The LLC is responsible for doing the translation between the Network Layer and the Data Link Layer. &lt;/p&gt;

&lt;p&gt;The MAC is responsible for adding headers and trailers to the packet, making it a "frame" now. &lt;/p&gt;

&lt;p&gt;The header will contain the source and destination MAC addresses. &lt;/p&gt;

&lt;p&gt;The trailer will contain information regarding error detection. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1: Physical Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This layer is responsible for converting the frames into bits, encoding the data into physical signals and the actual physical connection between the devices.  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Common Docker Commands</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Mon, 21 Jun 2021 04:22:38 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/common-docker-commands-4plk</link>
      <guid>https://dev.to/tomislavkraljic/common-docker-commands-4plk</guid>
      <description>&lt;p&gt;Hey y'all! In this article, I will go over a lot of the main/common docker commands and what they do. &lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker images&lt;/code&gt; - This displays all the images installed on your machine. It contains a lot of important information such as &lt;code&gt;tag&lt;/code&gt;, &lt;code&gt;size&lt;/code&gt;, &lt;code&gt;image id&lt;/code&gt;, and the repository installed. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker ps&lt;/code&gt; - This displays all the containers currently running at the moment. This is super helpful if we want to go inside the container and access/configure some data.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker pull &amp;lt;image&amp;gt;&lt;/code&gt; - This will pull a docker image from a repository. This could be from DockerHub, Nexus, AWS ECR, etc.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -d&lt;/code&gt; - This will run the docker image in "detached" mode. This means that it will be running in the background. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker stop &amp;lt;container_id&amp;gt;&lt;/code&gt; - This will stop the container from being executed. &lt;/p&gt;

&lt;p&gt;You should be aware that if the container is running a application with data saved/configured, all the data will be lost when you stop the container. To fix this, use Docker Volumes.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run &amp;lt;image&amp;gt;&lt;/code&gt; - This will create a new container to run an image and execute the container.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker start &amp;lt;container_id&amp;gt;&lt;/code&gt; This will launch the already existing container. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker log &amp;lt;container_id&amp;gt;&lt;/code&gt; - This will retrieve logs of the container running. This is great for debugging! &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker exec -it &amp;lt;container_id&amp;gt; bin/bash&lt;/code&gt; - This enables you to go inside the container that is running and run commands, check configs, environment variables, etc.&lt;/p&gt;

&lt;p&gt;If &lt;code&gt;/bin/bash&lt;/code&gt; doesn't work, use &lt;code&gt;/bin/sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -p &amp;lt;new_port&amp;gt;:&amp;lt;container_port&amp;gt;&lt;/code&gt; - This allows you to run the container on a separate host port. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t &amp;lt;name_of_image&amp;gt;:&amp;lt;tag&amp;gt;&lt;/code&gt; - This will build the image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker push &amp;lt;repository&amp;gt;:&amp;lt;tag&amp;gt;&lt;/code&gt; - This will push your docker image. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker tag &amp;lt;image&amp;gt;:&amp;lt;tag&amp;gt; &amp;lt;new_image&amp;gt;:&amp;lt;new_tag&amp;gt;&lt;/code&gt; - This will allow you to rename your image and create of copy of it. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker volume create --name &amp;lt;name&amp;gt;&lt;/code&gt; - This will allow you to create a volume and give it a custom name. &lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Configuring and Running Jenkins on a Remote Server with Docker</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Sun, 20 Jun 2021 03:26:31 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/configuring-and-running-jenkins-on-a-remote-server-with-docker-1cdl</link>
      <guid>https://dev.to/tomislavkraljic/configuring-and-running-jenkins-on-a-remote-server-with-docker-1cdl</guid>
      <description>&lt;p&gt;In this article, I will go over how you can start Jenkins up on a remote server using the official image from Docker. &lt;/p&gt;

&lt;p&gt;In this tutorial, for our server, I will use DigitalOcean. &lt;/p&gt;

&lt;p&gt;I do want to preface this by saying, running a remote server on DigitalOcean is not free. However, it is relatively cheap to start one up. &lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating/Configuring The Server
&lt;/h2&gt;

&lt;p&gt;1) Create an account with Digital Ocean. &lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; Type "https://www.digitalocean.com/" in your 
         browser&lt;/li&gt;
    &lt;li&gt; Click the "Sign Up" button on the top right of the website. &lt;/li&gt;
    &lt;li&gt; You can either create an account with your email, Github, or Google. &lt;/li&gt;
    &lt;li&gt; After you create an account, you will need to verify that it's you. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle0idp5o3u4koa9fscwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle0idp5o3u4koa9fscwg.png" alt="Digital Ocean Sign Up Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Next, you want to create a Digital Ocean (Droplet)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fathre87hwye76qu4n4z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fathre87hwye76qu4n4z2.png" alt="Create Droplet Button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) After creating a Digital Ocean Droplet, you want to configure some settings. Lets break it down!&lt;/p&gt;

&lt;p&gt;First, we will choose an image based on our current distribution. Currently, my machine is Linux Mint, so it is Ubuntu-based. Therefore, I will select "Ubuntu"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpux3pxunp8150c74x25l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpux3pxunp8150c74x25l.png" alt="Choose Image based on Distro"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Second, we will select our plan. I will go with the cheapest and select "Basic".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93n7psyknoufs4s4sh3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93n7psyknoufs4s4sh3d.png" alt="Choose Plan"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Third, in our CPU Options, we will select "Regular Intel with SSD" and select the $20/month plan.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxlv82i5p9857diyi4d9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxlv82i5p9857diyi4d9.png" alt="Choose CPU Options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fourth, select the region closest to you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhq0gj1p05tk3po7vvare.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhq0gj1p05tk3po7vvare.png" alt="Choose Region"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fifth, we will select our authentication option as SSH.If you don't have an SSH already configured, let's  configure it! &lt;/p&gt;

&lt;p&gt;Click "New SSH Key". A prompt will open up. On the right pane, you will see a command of "ssh-keygen" Follow the instructions given. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvytk9n4bbj2qnnis0j1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvytk9n4bbj2qnnis0j1k.png" alt="Authentication Options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6zl66i5wd6omu3xgsmp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6zl66i5wd6omu3xgsmp.png" alt="SSH Key Instructions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, click "Create Droplet"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffms6q8y1ggxtstu9yw0m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffms6q8y1ggxtstu9yw0m.png" alt="Click Create Droplet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Let's rename our droplet to something meaningful. I will be renaming mine to jenkins-tutorial-server. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1uatwkc387nm5hjbm8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1uatwkc387nm5hjbm8i.png" alt="Rename Droplet Name to Jenkins-Tutorial-Server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) Copy the IPV4 address because we will need it when configuring our firewall rules.&lt;/p&gt;

&lt;p&gt;5) Click on networking link and scroll down to Firewall and click "Edit"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyskvb0wek8qymyporzax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyskvb0wek8qymyporzax.png" alt="Click Networking Link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6) Next, we click the button that says "Create Firewall". &lt;/p&gt;

&lt;p&gt;7) We can name our firewall whatever we want. I will be naming mine "jenkins-tutorial-firewall". &lt;/p&gt;

&lt;p&gt;8) Next, we will paste our IPV4 address in the source of PORT 22. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcus2fu1r6875uwbutjbu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcus2fu1r6875uwbutjbu.png" alt="Add Your IPV4 Address To Port 22 Source"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9) We also want to add a custom port of 8080 to our Inbound Rules&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8k0dtgza71lfjct68nf7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8k0dtgza71lfjct68nf7.png" alt="Add custom port of 8080 to inbound rules"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;10) Finally, add the droplet we created to the Firewalls Rules at the bottom and click "Create" &lt;/p&gt;

&lt;h3&gt;
  
  
  Accessing The Remote Server Via Terminal
&lt;/h3&gt;

&lt;p&gt;Now, that we have created and configured our server on DigitalOcean, it is time to access it. &lt;/p&gt;

&lt;p&gt;1) Open the terminal and ssh into your server by using the IPv4 address.. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqqag30cqi9yvpzlvdnb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqqag30cqi9yvpzlvdnb.png" alt="SSH into server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Once you hit enter, you will be given a prompt of &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Are you sure you want to continue connecting (yes/no/[fingerprint])? 



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Type in "Yes" and hit enter again.&lt;/p&gt;

&lt;p&gt;Now, you are inside your remote server. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgetph4hpma91yb9uxjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgetph4hpma91yb9uxjz.png" alt="Inside remote server via terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Run &lt;code&gt;apt update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98mrsweicwg68iqilcli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98mrsweicwg68iqilcli.png" alt="run command 'apt update'"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) After that is complete, we need to install Docker by running the command run &lt;code&gt;apt install docker.io&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyipk4b4u0r9tm4oy0no1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyipk4b4u0r9tm4oy0no1.png" alt="Run command 'apt install docker.io'"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5) Then, to install Jenkins, we need to run the command &lt;code&gt;docker run -p 8080:8080 -p 50000:50000 -d -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;p 8080:8080&lt;/code&gt; we are binding the port that we specified in our Firewall of our server. This will allow us to access the UI of Jenkins. &lt;/p&gt;

&lt;p&gt;With &lt;code&gt;-p 50000:50000&lt;/code&gt;, we are specifying the port that the controller and agent nodes speak to each other on. Jenkins runs on a Controller-Agent architecture (that's a lesson for another day).&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;-d&lt;/code&gt;, we are running it in detached mode. This means that it will be running in the background. &lt;/p&gt;

&lt;p&gt;With &lt;code&gt;v jenkins_home:/var/jenkins_home&lt;/code&gt; we are using Docker Volumes to reference a volume name to bind where the data is being stored to the local machine. This insures that when we stop our container, all the data and configurations we make is not lost. &lt;/p&gt;

&lt;p&gt;Finally, with &lt;code&gt;jenkins/jenkins:lts&lt;/code&gt;, we are pulling and executing the official Jenkins latest image. &lt;/p&gt;

&lt;p&gt;6) After running this command, you want to type your IPv4 address, add a &lt;code&gt;:&lt;/code&gt; and port &lt;code&gt;8080&lt;/code&gt;. Once you do, you will be greeting with a Jenkins Page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkylzukkcthe8089v4bwh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkylzukkcthe8089v4bwh.png" alt="Unlock Jenkins Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7) We need the initial password to login. To do this we need to do the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the terminal run &lt;code&gt;docker ps&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Copy the Container ID&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;docker exec -it &amp;lt;container_image&amp;gt; /bin/bash&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Now, we are inside the docker container that is running 
Jenkins.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;cat /var/jenkins_home/secrets/initialAdminPassword&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Copy the password and paste it into the field of the Sign
In Page. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;8) Next, after logging in successfully, we will select &lt;code&gt;Install Suggested Plugins&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdmc6hiff2y8j1kvwr4yb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdmc6hiff2y8j1kvwr4yb.png" alt="Install Default Plugins"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;10) Now, we wait until all the plugins are installed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjlfs44ruuoe1s9w6ghwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjlfs44ruuoe1s9w6ghwy.png" alt="Installing Plugins"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;11) Next, we create our own admin user. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx36xctknmzckzlloxdzi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx36xctknmzckzlloxdzi.png" alt="Create Admin User"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;12) Congratulations, you successfully setup Jenkins on your own remote server on DigitalOcean using Docker!!&lt;/p&gt;

&lt;p&gt;Now, you can poke around, create jobs, install plugins, etc in Jenkins!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrcf2pyxxfa8eacscjzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrcf2pyxxfa8eacscjzh.png" alt="Jenkins Home Page"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
    </item>
    <item>
      <title>How Does Docker Work?</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Sat, 19 Jun 2021 03:32:47 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/how-does-docker-work-141a</link>
      <guid>https://dev.to/tomislavkraljic/how-does-docker-work-141a</guid>
      <description>&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is a containerization tool that enables developers to easily pack, ship, deploy and run their applications.&lt;/p&gt;

&lt;p&gt;If your application requires the installation of Node.js, Express, MongoDB, and Redis, you have to manually install these on your machine. Depending on the OS, this can get tedious and many things can go wrong. &lt;/p&gt;

&lt;p&gt;However, with Docker, all those configurations, services, dependencies are installed and all you have to do is run the image in a container. You no longer have to directly install anything yourself.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Image vs Container
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Image&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; File that holds the source code, configurations, dependencies, tools, etc needed to actually run the program &lt;/li&gt;

    &lt;li&gt; This is the actual package/artifact that can be moved around. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Container&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; A virtualized environment created during runtime that actually runs the image. &lt;/li&gt;
    &lt;li&gt; The container actually runs the image in its own virtual environment. &lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Docker vs Virtual Machine
&lt;/h2&gt;

&lt;p&gt;To understand Docker, we need to understand the Operating System and it's layers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QjSfVIDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vbcspm0ipeqmp1q0bqm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QjSfVIDb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vbcspm0ipeqmp1q0bqm7.png" alt="Docker Whale Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The application layer is everything you interact with. This would include any desktop applications, IDE's, internet, etc. This application layer runs on top of the Kernel. &lt;/p&gt;

&lt;p&gt;This OS Kernel handles device management, memory management, resource management, and accesses computer resources. It communicates with the hardware that includes the RAM, CPU, etc. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Docker&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; With Docker, the application layer is virtualized.
    &lt;/li&gt;
&lt;li&gt; Docker Containers run/start faster! 
    &lt;/li&gt;
&lt;li&gt; Images are smaller. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Virtual Machine&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; A VM virtualizes both the application layer AND Operating System Kernel. &lt;/li&gt;
    &lt;li&gt; A VM can run an operating system on any host machine. However, with Docker, you can't. &lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Docker Engine
&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt; When you install Docker, you install the Docker Engine under the hood. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Docker Engine is comprised of three components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Responsible for pulling images&lt;/li&gt;
&lt;li&gt;Responsible for managing images and containers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API&lt;/strong&gt; 

&lt;ul&gt;
&lt;li&gt;Responsible for interacting with docker server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CLI&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;This is the client that is responsible for executing 
docker commands

&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Docker's Architecture
&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt; Docker uses a client-server architecture. &lt;/li&gt;
    &lt;li&gt; Docker's client (CLI) talks to the Docker 
         server(daemon) which does the heavy lifting of 
         building, running, distributing your containers. 
    &lt;/li&gt;
    &lt;li&gt; When we talk about the daemon, it is simply a process called dockerd running in the background waiting for any requests by the API &lt;/li&gt; 
    &lt;li&gt; The docker daemon (dockerd) listens for Docker API requests and manages docker objects(images, containers, networks, and volumes).&lt;/li&gt;
    &lt;li&gt; A daemon can also communicate with other daemons to manage the services. &lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Docker Server's Responsibilities:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Container Runtime&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Responsible for pulling images and managing container 
life-cycle.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volumes&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Responsible for persisting data in containers when a 
container stops running or something goes bad. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Responsible for configuring networks for container 
communication&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The functionality of building docker images&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Storage Classes in C</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Sun, 16 May 2021 06:51:44 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/storage-classes-in-c-4jl8</link>
      <guid>https://dev.to/tomislavkraljic/storage-classes-in-c-4jl8</guid>
      <description>&lt;p&gt;In this article, I will go over the four storage classes in C: auto, extern, static and register. I will explain how to use them and the specifics of each storage class.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Storage Class?
&lt;/h3&gt;

&lt;p&gt;A storage class is a way to describe the features of a variable or function.&lt;/p&gt;

&lt;p&gt;This includes:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; Scope, visibility, and life-time. &lt;/li&gt;
    &lt;li&gt; Help us trace the existence of a particular variable during the run time of a program.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  What Storage Classes Does C Provide?
&lt;/h3&gt;

&lt;p&gt;C provides &lt;strong&gt;4&lt;/strong&gt; storage classes: &lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; auto &lt;/li&gt;
    &lt;li&gt; extern &lt;/li&gt;
    &lt;li&gt; static &lt;/li&gt;
    &lt;li&gt; extern &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These can be divided into &lt;strong&gt;2&lt;/strong&gt; storage duration's:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; automatic storage duration &lt;/li&gt;
    &lt;li&gt; static storage duration &lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Auto Storage Class
&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt; The keyword auto is used to declare variables of automatic storage duration. &lt;/li&gt;
    &lt;li&gt; It means it is a local variable. &lt;/li&gt;
    &lt;li&gt; Every local variable created, is implicitly 'auto' &lt;/li&gt;
    &lt;li&gt; Created when the block in which they are defined is entered. &lt;/li&gt;
    &lt;li&gt; Destroyed when the block is exited. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why use Auto?&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; Automatic storage is a way of conserving memory. We do not want every variable to be global.&lt;/li&gt;
    &lt;li&gt; We only want to use these variables when absolutely necessary. &lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

int main(int argc, char * argv[]){
    auto int age = 23; // same as int age = 23;
    printf("%d\n", age);

    return EXIT_SUCCESS;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Extern Storage Class
&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt; The extern storage class simply tells us that a variable is defined somewhere else. &lt;/li&gt;
    &lt;li&gt; We are telling the compiler "Hey, don't freak out. The variable is defined somewhere else and I am gonna use it. &lt;/li&gt;
    &lt;li&gt; The main purpose of using extern variables is that they can be accessed between different source files in a large program. &lt;/li&gt;
    &lt;li&gt; Functions contained in separate files can communicate through extern variables. &lt;/li&gt;
    &lt;li&gt; Functions are implicitly 'extern' as well. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example 1&lt;/p&gt;

&lt;p&gt;&lt;em&gt;main.c&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

extern int x;
extern int b;
extern void print_x();
extern void print_b();

int main(int argc, char * argv[]){
    print_x(); //32
    print_b(); //8

    x = 50;
    b = 99;

    print_x(); //50
    print_b(); //90

    return EXIT_SUCCESS;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;extern.h&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int x;
int b;
void print_x();
void print_b();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;extern.c&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
int x = 32;
int b = 8;

void print_x() { printf("%d\n", x); };

void print_x() { printf("%d\n", b); };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Static Storage Class
&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt; The static storage class can be used on local and global variables and functions. &lt;/li&gt;
    &lt;li&gt; When applied to local variables, it instructs the compiler to keep the variable alive during the lifetime of the program (just like a global variable). &lt;/li&gt;
    &lt;li&gt; When applied to global variables, it instructs the global variable to only be able to be used/accessed in that file that it was declared in. &lt;/li&gt;
    &lt;li&gt; When applied to functions, it instructs the function to only be able to be called from the same file where it appeared. &lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

void print_and_increment();

void print_and_increment_with_static();

int main(int argc, char * argv[]) {
    print_and_increment(); //1
    print_and_increment(); //1

    print_and_increment_with_static(); //1
    print_and_increment_with_static(); //2


}

void print_and_increment(){
    int value_one = 0;
    ++value_one;
    printf("%d\n", value_one);
}

void print_and_increment_with_static(){
   static int value_two = 0;
   ++value_two;
   printf("%d\n", value_two);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
    &lt;li&gt; Here, we are seeing two different results. &lt;/li&gt;
    &lt;li&gt; The variable value_one only exists within the block of the function print_and_increment. When it leaves the scope, the variable is destroyed. No matter how many times we call it, we will get the same result. &lt;/li&gt;
    &lt;li&gt; The variable value_two is static. Therefore, it exists throughout the entire program. It is not local. Every time we call it, the value changes. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: Static variables should not be declared inside a struct. The C compiler requires the entire struct element to be placed together.&lt;/p&gt;




&lt;h3&gt;
  
  
  Register Storage Class
&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt; A processor register is a local storage space within the CPU that holds instructions, storage addresses, or any kind of data. &lt;/li&gt;
    &lt;li&gt; The register storage class is used to define local variables that should be stored in the register instead of the RAM &lt;/li&gt;
    &lt;li&gt; Makes the use of register variables faster than variables stored in RAM. &lt;/li&gt;
    &lt;li&gt; The keyword 'register' suggests to the compiler to put the variable inside the register. &lt;/li&gt;
    &lt;li&gt; Sometimes the compiler will listen, other times it wont. It is largely dependent on hardware and implementation restrictions. &lt;/li&gt;
    &lt;li&gt; Generally, the compiler will do it by itself regardless if you use this keyword or not. &lt;/li&gt;
    &lt;li&gt; You can not get the address of a register variable. &lt;/li&gt;
    &lt;li&gt; Register variables have the same life-span as an auto variable(local variable). &lt;/li&gt;
    &lt;li&gt; Therefore, register variables can not be declared globally, only locally. &lt;/li&gt; 
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

int main(int argc, char * argv[]) }
    register int age = 23;

    printf("Your age is %d\n", age);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>c</category>
    </item>
    <item>
      <title>Portability Bug in Window OS for STDIN</title>
      <dc:creator>Tomislav Kraljic</dc:creator>
      <pubDate>Sat, 15 May 2021 03:29:44 +0000</pubDate>
      <link>https://dev.to/tomislavkraljic/portability-bug-in-window-os-for-c-programming-3pje</link>
      <guid>https://dev.to/tomislavkraljic/portability-bug-in-window-os-for-c-programming-3pje</guid>
      <description>&lt;p&gt;I recently made a switch to Emacs and I stumbled upon a "bug" in the Windows OS when it comes to writing portable code in C. I will explain this bug in great detail in this article.&lt;/p&gt;

&lt;p&gt;Let's first examine the bug.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

int main(int argc, char * argv[]){
    int age;

    printf("Enter age: ");

    scanf("%d", &amp;amp;age);

    printf("You are %d years old.", age);

    return EXIT_SUCCESS;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, I ran this code in Emacs on Windows. This should work right?&lt;/p&gt;

&lt;p&gt;It doesn't. &lt;/p&gt;

&lt;p&gt;How so?&lt;/p&gt;

&lt;p&gt;When you run the program, the printf() statement does not show up in the console. It immediately is reading input. Then, when you enter the age, you get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;23
Enter Age: You are 23 years old

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem is how Windows handles I/O. &lt;/p&gt;

&lt;p&gt;On Unix-like systems, inclusing MacOS, stdout has line based buffering. This means that &lt;code&gt;stdout&lt;/code&gt; is flushed after seeing a newline. &lt;/p&gt;

&lt;p&gt;However, Windows does not support line-based buffering. Newlines are no longer special and and full buffering is used. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;stdout&lt;/code&gt; on Windows is either always unbuffered when attached to the console or fully buffered.&lt;/p&gt;

&lt;p&gt;This is the options for stdout on Windows: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cqrNI2IU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wn5bs0755p19k95whr91.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cqrNI2IU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wn5bs0755p19k95whr91.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This stems from the expectation that &lt;code&gt;stdout&lt;/code&gt; buffering should behave like in POSIX systems, which is not necessarily the case on 'windows-nt.&lt;/p&gt;

&lt;p&gt;MacOS and Linux are mostly POSIX compliant while Windows is not. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5M0g-QXG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9r9xzyy9onku7mkh79mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5M0g-QXG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9r9xzyy9onku7mkh79mx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under "stderr, stdin, stdout - standard I/O streams", POSIX standard reads:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;At program start-up, three streams shall be predefined and need not be opened explicitly: standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output). When opened, the standard error stream is not fully buffered; the standard input and standard output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Windows uses pipes to communicate with subprocesses, while on Posix platforms use PTYs, which are a kind of console device.&lt;/p&gt;

&lt;p&gt;However, Windows came out with WSL to solve this. WSL is POSIX compliant. But if you were to not use WSL, you would run into this portability issue. The resolution to this problem is to explicitly flush using:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;fflush()&lt;/code&gt; or &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setvbuf(stdout, NULL, _IONBF, 0);&lt;/code&gt; // turn off buffering for stdout&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
      <category>c</category>
    </item>
  </channel>
</rss>
