<?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: Roseline Bassey</title>
    <description>The latest articles on DEV Community by Roseline Bassey (@roselinebassey).</description>
    <link>https://dev.to/roselinebassey</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%2F831087%2Fb406cd0c-8dbb-4e8b-889e-2cfec2cf7fb8.jpg</url>
      <title>DEV Community: Roseline Bassey</title>
      <link>https://dev.to/roselinebassey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/roselinebassey"/>
    <language>en</language>
    <item>
      <title>Android App: Instrumented and Unit Tests Automation Using CircleCI</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Wed, 10 May 2023 09:17:05 +0000</pubDate>
      <link>https://dev.to/roselinebassey/android-automate-instrumented-and-unit-tests-with-circleci-1igo</link>
      <guid>https://dev.to/roselinebassey/android-automate-instrumented-and-unit-tests-with-circleci-1igo</guid>
      <description>&lt;p&gt;As an Android developer, testing is an integral part of the app development process. By running tests you can verify your app’s functional behaviour, correctness, and usability before you release it to the public.  CircleCI is a CI platform that supports running Android emulators from within an Android machine image. We will use CircleCI to set up automated testing for our project. Automated testing involves using tools that perform tests on the project for you, which is faster, repeatable, and gives you more actionable feedback about your app earlier in the development process.&lt;/p&gt;

&lt;p&gt;This article describes how to automate  instrumentation and unit tests for an open source Android project using CircleCI. I assume you already know how to create an Android app and write tests for your app.  The cloned project and working pipeline can be found &lt;a href="https://github.com/Roseline-Bassey/androidlibrary" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Instrumentation Testing
&lt;/h2&gt;

&lt;p&gt;Instrumented tests, also known as instrumentation tests, are tests that run on Android devices, whether physical or emulated. It involves testing the overall behaviour of an application by testing the interaction between different components. It checks how the application performs when different components work together, including user interfaces, APIs, and external dependencies. This type of testing helps identify issues that may arise due to interactions between components, such as compatibility issues or performance problems. &lt;/p&gt;

&lt;h2&gt;
  
  
  Unit Testing
&lt;/h2&gt;

&lt;p&gt;Unit testing involves testing individual components or units of code in isolation to verify their functionality, usually a single class or function. In unit testing, each unit of code is tested separately from the rest of the codebase to ensure that it behaves as expected. &lt;/p&gt;

&lt;h2&gt;
  
  
  CircleCI
&lt;/h2&gt;

&lt;p&gt;CircleCI is a hosted and automated solution for continuous integration (CI) builds. It uses an in app configuration file that uses YAML syntax.  CircleCI is easier to set up and is hosted in the cloud.  After learning about instrumentation tests, unit testing, and CircleCI, we can now learn how testing in CI/CD works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unit Testing and Instrumentation Testing in CI/CD
&lt;/h2&gt;

&lt;p&gt;As a  DevOps principle, it is a good practice to automate testing as part of the CI process to test your code against any bug. Automated tests can be triggered at various stages of your CircleCI pipeline, including development, staging, and/or production. An effective automated test runs immediately after changes are committed to the version control system's (for example, GitHub) staging or development repository. If the test meets the success criteria, then the committed change(s) may proceed to the next stage or environment. If the test failed, the committed changes are blocked from proceeding until those issues are resolved. By automating tests, teams can have confidence that code changes have been thoroughly tested and have met the success and quality standards, thereby, protecting the production environment against disruptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Automated Android Testing on CircleCI
&lt;/h2&gt;

&lt;p&gt;Firstly, we will set up our &lt;code&gt;config.yml&lt;/code&gt;file to run unit tests. I'll demonstrate two approaches for running instrumentation tests on CircleCI: using the No-orb and Orb examples. The No-orb example is a more complex process because you would have to write the steps yourself, while the CircleCI Android orb example is an easy process with many steps already written for you. There's no need to worry, the No-orb example is not as difficult as it seems because CircleCi offers clear &lt;a href="https://circleci.com/docs/android-machine-image/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; that will make setup simple. Please take note that you should only use one of the examples in your &lt;code&gt;config.yml&lt;/code&gt; file. The two instances given here are merely for demonstration. Let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a &lt;code&gt;circleci.yml&lt;/code&gt; File
&lt;/h2&gt;

&lt;p&gt;At the root of your project’s folder, create a &lt;code&gt;.circleci&lt;/code&gt; folder. Inside the folder create a &lt;code&gt;config.yml&lt;/code&gt; file. Our workflow will be in this order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit Tests&lt;/li&gt;
&lt;li&gt;Instrumentation Tests&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Running Unit Test
&lt;/h3&gt;

&lt;p&gt;We will call our job &lt;code&gt;unit-tests&lt;/code&gt;. The &lt;code&gt;working_directory&lt;/code&gt; specifies the location of the project files. The docker image section specifies the Docker image to use. In this case, it uses the &lt;code&gt;cimg/android:2023.02&lt;/code&gt; image.&lt;/p&gt;

&lt;p&gt;Here’s a full look at the unit test job:&lt;/p&gt;

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

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2.&lt;/span&gt;
&lt;span class="na"&gt;unit-tests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;working_directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/project&lt;/span&gt;
    &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cimg/android:2023.02&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Unit Tests&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew clean test&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_test_results&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app/build/test-results&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;The steps section includes three steps: first CircleCI checks out the repository where the code is stored. Then, run unit tests using the &lt;code&gt;./gradlew clean test&lt;/code&gt; command, and store the test results at the path specified. &lt;/p&gt;

&lt;h2&gt;
  
  
  Running Instrumentation Tests
&lt;/h2&gt;

&lt;p&gt;As I mentioned earlier, there are different approaches to doing this. We will cover two examples or approaches. The first example is the No-orb example. &lt;/p&gt;

&lt;h3&gt;
  
  
  Using the No-orb Example
&lt;/h3&gt;

&lt;p&gt;Our instrumented test requires an emulator to run on a machine image. Below is a breakdown of the instrumentation tests job. The full code is provided below. We will add each step to the instrumented test &lt;code&gt;job&lt;/code&gt; in the &lt;code&gt;circleci.yml&lt;/code&gt; file.&lt;/p&gt;

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

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;instrumented_test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;machine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;android:202102-01&lt;/span&gt;
    &lt;span class="na"&gt;resource_class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;large&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;So in the instrumented test job, we specify the &lt;code&gt;image: android:202102-01&lt;/code&gt; as the machine image and set the &lt;code&gt;resource_class&lt;/code&gt; of the machine as "large" to improve build time. Under the &lt;code&gt;step&lt;/code&gt; section we have the following steps:&lt;/p&gt;

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

&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create avd&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;SYSTEM_IMAGES="system-images;android-29;default;x86"&lt;/span&gt;
            &lt;span class="s"&gt;sdkmanager "$SYSTEM_IMAGES"&lt;/span&gt;
            &lt;span class="s"&gt;echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;- checkout&lt;/code&gt; checks out the code from the repository while the command under &lt;code&gt;- Create avd&lt;/code&gt; installs the Android system image required for the emulator to run, and creates a new virtual device named "test".&lt;/p&gt;

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

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Launch emulator&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim&lt;/span&gt;
          &lt;span class="na"&gt;background&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Launch emulator&lt;/code&gt; command launches the emulator and waits for it to start up. It runs in the background (background: true) so that other steps can execute in parallel.&lt;/p&gt;

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

 &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Generate cache key&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;find . -name 'build.gradle' | sort | xargs cat |&lt;/span&gt;
            &lt;span class="s"&gt;shasum | awk '{print $1}' &amp;gt; /tmp/gradle_cache_seed&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Generate cache key&lt;/code&gt; command generates a cache key based on the contents of the build.gradle files in the project. This key is used to restore the Gradle cache later, to speed up the build process.&lt;/p&gt;

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

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;restore_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;restore_cache&lt;/code&gt; step attempts to restore the Gradle cache from a previous build, using the cache key generated in the previous step.&lt;/p&gt;

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

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# run in parallel with the emulator starting up, to optimize build time&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run assembleDebugAndroidTest task&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew assembleDebugAndroidTest&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;assembleDebugAndroidTest&lt;/code&gt; command compiles and build the debug version of the Android test APK and runs in parallel with the emulator starting up, to optimize build time.&lt;/p&gt;

&lt;p&gt;This step can be modified to suit your project needs. I modified the above☝️ step to this:👇&lt;/p&gt;

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

 &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# run in parallel with the emulator starting up, to optimize build time&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run compileDemoBasicDebugJavaWithJavac task&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew compileDemoBasicDebugJavaWithJavac&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;This step compiles the Java code in the project using the javac compiler. This runs in parallel with the emulator starting up, to optimize build time.&lt;/p&gt;

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

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Wait for emulator to start&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;circle-android wait-for-boot&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;As the name implies, the &lt;code&gt;Wait for emulator to start&lt;/code&gt;step waits for the emulator to finish booting up and become available for testing.&lt;/p&gt;

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

   &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Disable emulator animations&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global window_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global transition_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global animator_duration_scale 0.0&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Disable emulator animations&lt;/code&gt; step disables the emulator animations to speed up the testing process.&lt;/p&gt;

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

 &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run UI tests (with retry)&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;MAX_TRIES=2&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry() {&lt;/span&gt;
               &lt;span class="s"&gt;n=1&lt;/span&gt;
               &lt;span class="s"&gt;until [ $n -gt $MAX_TRIES ]&lt;/span&gt;
               &lt;span class="s"&gt;do&lt;/span&gt;
                  &lt;span class="s"&gt;echo "Starting test attempt $n"&lt;/span&gt;
                  &lt;span class="s"&gt;./gradlew connectedAndroidTest &amp;amp;&amp;amp; break&lt;/span&gt;
                  &lt;span class="s"&gt;n=$[$n+1]&lt;/span&gt;
                  &lt;span class="s"&gt;sleep 5&lt;/span&gt;
               &lt;span class="s"&gt;done&lt;/span&gt;
               &lt;span class="s"&gt;if [ $n -gt $MAX_TRIES ]; then&lt;/span&gt;
                 &lt;span class="s"&gt;echo "Max tries reached ($MAX_TRIES)"&lt;/span&gt;
                 &lt;span class="s"&gt;exit 1&lt;/span&gt;
               &lt;span class="s"&gt;fi&lt;/span&gt;
            &lt;span class="s"&gt;}&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;Run UI tests (with retry)&lt;/code&gt; runs the instrumented tests on the emulator, with a retry mechanism in case of failures. The &lt;code&gt;connectedAndroidTest&lt;/code&gt; command is the main command which runs the tests.&lt;/p&gt;

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

 &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;save_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;
          &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/caches&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/wrapper&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;save_cache&lt;/code&gt; saves the Gradle cache for future builds, using the cache key generated earlier.&lt;/p&gt;

&lt;p&gt;Let's take a look at the whole &lt;code&gt;config.yml&lt;/code&gt; file, which includes both the unit tests and the instrumentation tests jobs:&lt;/p&gt;

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

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2.&lt;/span&gt;
&lt;span class="na"&gt;unit-tests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;working_directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/project&lt;/span&gt;
    &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cimg/android:2023.02&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Unit Tests&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew clean test&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_test_results&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app\build\test-results&lt;/span&gt;

&lt;span class="na"&gt;instrumented_test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;machine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;android:202102-01&lt;/span&gt;
    &lt;span class="na"&gt;resource_class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;large&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create avd&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;SYSTEM_IMAGES="system-images;android-29;default;x86"&lt;/span&gt;
            &lt;span class="s"&gt;sdkmanager "$SYSTEM_IMAGES"&lt;/span&gt;
            &lt;span class="s"&gt;echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Launch emulator&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim&lt;/span&gt;
          &lt;span class="na"&gt;background&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Generate cache key&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;find . -name 'build.gradle' | sort | xargs cat |&lt;/span&gt;
            &lt;span class="s"&gt;shasum | awk '{print $1}' &amp;gt; /tmp/gradle_cache_seed&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;restore_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# run in parallel with the emulator starting up, to optimize build time&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run assembleDebugAndroidTest task&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew assembleDebugAndroidTest&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Wait for emulator to start&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;circle-android wait-for-boot&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Disable emulator animations&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global window_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global transition_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global animator_duration_scale 0.0&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run UI tests (with retry)&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;MAX_TRIES=2&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry() {&lt;/span&gt;
               &lt;span class="s"&gt;n=1&lt;/span&gt;
               &lt;span class="s"&gt;until [ $n -gt $MAX_TRIES ]&lt;/span&gt;
               &lt;span class="s"&gt;do&lt;/span&gt;
                  &lt;span class="s"&gt;echo "Starting test attempt $n"&lt;/span&gt;
                  &lt;span class="s"&gt;./gradlew connectedAndroidTest &amp;amp;&amp;amp; break&lt;/span&gt;
                  &lt;span class="s"&gt;n=$[$n+1]&lt;/span&gt;
                  &lt;span class="s"&gt;sleep 5&lt;/span&gt;
               &lt;span class="s"&gt;done&lt;/span&gt;
               &lt;span class="s"&gt;if [ $n -gt $MAX_TRIES ]; then&lt;/span&gt;
                 &lt;span class="s"&gt;echo "Max tries reached ($MAX_TRIES)"&lt;/span&gt;
                 &lt;span class="s"&gt;exit 1&lt;/span&gt;
               &lt;span class="s"&gt;fi&lt;/span&gt;
            &lt;span class="s"&gt;}&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;save_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;
          &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/caches&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/wrapper&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_test_results&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app\build\outputs\androidTest-results&lt;/span&gt;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Using Android Orb Example
&lt;/h2&gt;

&lt;p&gt;Since CircleCi has already done some of the work, this step is a bit shorter than the first example. So, you can use this instead of the No-orb example and it'll still function the same.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;


&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.1&lt;/span&gt;
&lt;span class="na"&gt;orbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;android&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;circleci/android@2.1.2&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;android-test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;executor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;android/android-machine&lt;/span&gt;
      &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;202102-01"&lt;/span&gt;
      &lt;span class="na"&gt;resource-class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;large&lt;/span&gt;
    &lt;span class="c1"&gt;#run instrumentation tests&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;installing emulator and Running Instrumentation tests&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;sdkmanager "platform-tools" "platforms;android-29" "build-tools;30.0.0" "emulator"&lt;/span&gt;
            &lt;span class="s"&gt;sdkmanager "system-images;android-29;google_apis;x86"&lt;/span&gt;
            &lt;span class="s"&gt;echo no | avdmanager create avd -n test-emulator -k  "system-images;android-29;google_apis;x86"&lt;/span&gt;
            &lt;span class="s"&gt;emulator -avd test-emulator -noaudio -no-boot-anim -gpu off -no-window &amp;amp;&lt;/span&gt;
            &lt;span class="s"&gt;adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'&lt;/span&gt;
            &lt;span class="s"&gt;adb shell wm dismiss-keyguard&lt;/span&gt;
            &lt;span class="s"&gt;sleep 1&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global window_animation_scale 0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global transition_animation_scale 0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global animator_duration_scale 0&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew connectedAndroidTest&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;It's time to see our CI test in action on CircleCI.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Setup CircleCI
&lt;/h2&gt;

&lt;p&gt;Make sure you have created at the root of your project’s folder, a &lt;code&gt;.circleci&lt;/code&gt; folder, and inside of the folder you have a &lt;code&gt;config.yml&lt;/code&gt; file. Before moving on to CircleCI, let's add a build job at the beginning of the &lt;code&gt;config.yml&lt;/code&gt; file and define the workflow of our build pipeline at the end of the file. Using the no-orb example, the final &lt;code&gt;config.yml&lt;/code&gt; file will look like this: &lt;/p&gt;

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

&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.1&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;working_directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/project&lt;/span&gt;
    &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cimg/android:2023.02&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;restore_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;keys&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;v1-dependencies-{{ checksum "build.gradle" }}&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;v1-dependencies-&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Install dependencies&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./gradlew androidDependencies&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;save_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.android&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1-dependencies-{{ checksum "build.gradle" }}&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build project&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./gradlew clean assemble&lt;/span&gt;

&lt;span class="na"&gt;unit tests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;working_directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/project&lt;/span&gt;
    &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cimg/android:2023.02&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Local UnitTests&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew clean test&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_test_results&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app\build\test-results&lt;/span&gt;


  &lt;span class="na"&gt;instrumented_test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;machine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;android:202102-01&lt;/span&gt;
    &lt;span class="na"&gt;resource_class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;large&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create avd&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;SYSTEM_IMAGES="system-images;android-29;default;x86"&lt;/span&gt;
            &lt;span class="s"&gt;sdkmanager "$SYSTEM_IMAGES"&lt;/span&gt;
            &lt;span class="s"&gt;echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Launch emulator&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim&lt;/span&gt;
          &lt;span class="na"&gt;background&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Generate cache key&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;find . -name 'build.gradle' | sort | xargs cat |&lt;/span&gt;
            &lt;span class="s"&gt;shasum | awk '{print $1}' &amp;gt; /tmp/gradle_cache_seed&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;restore_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# run in parallel with the emulator starting up, to optimize build time&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run compileDemoBasicDebugJavaWithJavac task&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;./gradlew compileDemoBasicDebugJavaWithJavac&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Wait for emulator to start&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;circle-android wait-for-boot&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Disable emulator animations&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global window_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global transition_animation_scale 0.0&lt;/span&gt;
            &lt;span class="s"&gt;adb shell settings put global animator_duration_scale 0.0&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run UI tests (with retry)&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;MAX_TRIES=2&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry() {&lt;/span&gt;
               &lt;span class="s"&gt;n=1&lt;/span&gt;
               &lt;span class="s"&gt;until [ $n -gt $MAX_TRIES ]&lt;/span&gt;
               &lt;span class="s"&gt;do&lt;/span&gt;
                  &lt;span class="s"&gt;echo "Starting test attempt $n"&lt;/span&gt;
                  &lt;span class="s"&gt;./gradlew connectedAndroidTest &amp;amp;&amp;amp; break&lt;/span&gt;
                  &lt;span class="s"&gt;n=$[$n+1]&lt;/span&gt;
                  &lt;span class="s"&gt;sleep 5&lt;/span&gt;
               &lt;span class="s"&gt;done&lt;/span&gt;
               &lt;span class="s"&gt;if [ $n -gt $MAX_TRIES ]; then&lt;/span&gt;
                 &lt;span class="s"&gt;echo "Max tries reached ($MAX_TRIES)"&lt;/span&gt;
                 &lt;span class="s"&gt;exit 1&lt;/span&gt;
               &lt;span class="s"&gt;fi&lt;/span&gt;
            &lt;span class="s"&gt;}&lt;/span&gt;
            &lt;span class="s"&gt;run_with_retry&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;save_cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}&lt;/span&gt;
          &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/caches&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;~/.gradle/wrapper&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_test_results&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app\build\outputs\androidTest-results&lt;/span&gt;

&lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build_and_deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;build&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;instrumented_test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;requires&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;build&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;unit tests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;requires&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;build&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Next, login to CircleCI using your GitHub, BitBucket, or GitLab account. In the CircleCI web, click on projects at the sidebar and then select which project on your version control you want CircleCI to build on. In my case, I selected the &lt;code&gt;androidlibrary&lt;/code&gt;project.&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%2F998tfgnpebbxagxbtnnf.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%2F998tfgnpebbxagxbtnnf.png" alt="CircleCI build dashboard"&gt;&lt;/a&gt;&lt;br&gt;
In the “Select your config.yml file” modal, select &lt;strong&gt;Fastest&lt;/strong&gt;, and a pop-up will appear like so:&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%2F8er29i8oqz0padvhuid2.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%2F8er29i8oqz0padvhuid2.png" alt="CircleCI"&gt;&lt;/a&gt;&lt;br&gt;
Under &lt;strong&gt;fastest&lt;/strong&gt; select to choose your preferred project and the branch where the project is located, then click &lt;strong&gt;Set Up Project&lt;/strong&gt; to start building your project on CircleCI. You can monitor the build process on your dashboard. On a successful build, you'll have a green build like below:&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%2Ffvuqxxcujur7pc5woqdj.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%2Ffvuqxxcujur7pc5woqdj.png" alt="CircleCI Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that the instrumentation tests job may take a few more minutes than other jobs to build. The time taken is solely dependent on your project. It took almost five minutes for the instrumentation test to finish building in my case.&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%2Fpjewk5lykmt2ye4uiz4m.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%2Fpjewk5lykmt2ye4uiz4m.png" alt="CircleCi dashboard showing build time"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;In this article, you learned how to automate testing for your Android project using CircleCI. How to set up unit tests and also learned two approaches to setting up instrumentation tests on CirCleCI. You've learned the benefits of automating testing in CI and you've seen the CI test in action on CircleCI.&lt;/p&gt;

</description>
      <category>circleci</category>
      <category>cicd</category>
      <category>android</category>
      <category>testing</category>
    </item>
    <item>
      <title>How to Set Up an Nginx Web Server in Ubuntu Virtual Machine Using Vagrant</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Fri, 05 May 2023 16:16:55 +0000</pubDate>
      <link>https://dev.to/roselinebassey/how-to-set-up-an-nginx-web-server-in-ubuntu-virtual-machine-using-vagrant-25gm</link>
      <guid>https://dev.to/roselinebassey/how-to-set-up-an-nginx-web-server-in-ubuntu-virtual-machine-using-vagrant-25gm</guid>
      <description>&lt;p&gt;If you explore many Developers and DevOps toolkits, you'll likely come across Vagrant - a tool that is widely used by teams to develop virtual environments that mirror the production environment. One of the advantages of using Vagrant is its ability to reduce the occurrence of bugs or issues before delivering code to the production environment.&lt;/p&gt;

&lt;p&gt;In this project tutorial, you'll gain insight into the process of setting up an Nginx web server on Ubuntu, along with how to manually and automatically replace the Nginx default page with an actual web page using Vagrant. By the end of this tutorial, you'll have learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Vagrant and VirtualBox on your local machine.&lt;/li&gt;
&lt;li&gt;Set up Ubuntu virtual machine in VirtualBox using Vagrant&lt;/li&gt;
&lt;li&gt;Set up an Nginx web server on Ubuntu to host a web page.&lt;/li&gt;
&lt;li&gt;Replace the default Nginx web server home page with our web application.&lt;/li&gt;
&lt;li&gt;Automatically host our web page on Nginx using Vagrant.&lt;/li&gt;
&lt;li&gt;Validate and access it from your local machine's web browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Vagrant
&lt;/h2&gt;

&lt;p&gt;Vagrant is an open source tool for creating and managing reproducible virtual development environments that run on any machine. It manages virtual machines with a configuration file called Vagrantfile. This file is sharable and controls the lifecycle of a virtual machine, including starting, halting, and provisioning them.  Let's imagine you have a Vagrantfile that was created by someone else on your computer. You can replicate the same environment or virtual machine (VM) as the original with merely the "vagrant up" command. &lt;br&gt;
In 2010, HashiCorp created Vagrant, which is widely used in the technological stacks of organizations including Airbnb, Accenture, Coursera, and Shopify. Several virtualization service providers, including VirtualBox, VMware, Docker, and Hyper-V, are supported by Vagrant.&lt;/p&gt;

&lt;h2&gt;
  
  
  VirtualBox
&lt;/h2&gt;

&lt;p&gt;VirtualBox is a free virtualization software that helps users run a second computer with a different operating system from their host computer. As in our case, we will run an Ubuntu operating system in VirtualBox separate from our Windows host computer. VirtualBox supports a variety of operating systems, including Windows, Linux, and macOS. It also comes with some nice features. For example, it supports virtual networking, which enables communication between virtual machines and the host computer. When testing network configurations or running servers in a virtual environment, this can be incredibly helpful. &lt;/p&gt;

&lt;h2&gt;
  
  
  Ubuntu
&lt;/h2&gt;

&lt;p&gt;Ubuntu is one of the most widely used Linux distributions based on the Linux Kernel. In this tutorial, this will be utilized to run our web server.&lt;/p&gt;

&lt;h2&gt;
  
  
  NGINX
&lt;/h2&gt;

&lt;p&gt;Nginx is a popular web server software that is widely used to host both static and dynamic web pages that can be accessed by users over the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before You Dive In
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;As a prerequisite, your computer needs to have around 10GB of free disk space and at least 8GB of RAM to run Linux in a virtual machine.&lt;/li&gt;
&lt;li&gt; Follow the instructions provided in the official VirtualBox documentation to &lt;a href="https://www.virtualbox.org/wiki/Downloads" rel="noopener noreferrer"&gt;download and install VirtualBox&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Similarly, &lt;a href="https://www.vagrantup.com/" rel="noopener noreferrer"&gt;download and install Vagrant&lt;/a&gt; by following the instructions provided on the official Vagrant documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating an Ubuntu Virtual Machine Using Vagrant
&lt;/h2&gt;

&lt;p&gt;Assuming you have your VirtualBox and Vagrant installed, we'll begin by setting up a virtual machine using Vagrant. We need to first create a new directory on our desktop. To do this, use your Windows Command Prompt or Windows Powershell to execute the following commands:&lt;/p&gt;

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

cd Desktop       
mkdir myproject
cd myproject
vagrant init


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

&lt;/div&gt;

&lt;p&gt;Your terminal should look like this:&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%2Fmyupnag544j6fniagrko.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%2Fmyupnag544j6fniagrko.png" alt="A terminal showing some commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;line 1&lt;/strong&gt; you used the &lt;code&gt;cd&lt;/code&gt; command to navigate into your desktop environment. While in &lt;strong&gt;line 2&lt;/strong&gt;, you used the &lt;code&gt;mkdir&lt;/code&gt; command to create a new folder or directory called &lt;code&gt;myproject&lt;/code&gt; on your desktop. Next, you &lt;code&gt;cd&lt;/code&gt; into the newly created directory in &lt;strong&gt;line 3&lt;/strong&gt;. Then, you initialize a new vagrant machine in &lt;strong&gt;line 4&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After executing the command at &lt;strong&gt;line 4&lt;/strong&gt;, you’ll notice that a &lt;code&gt;Vagrantfile&lt;/code&gt; has been created inside your directory.  Let's add some setup to our 'Vagrantfile' before starting our virtual environment.&lt;/p&gt;

&lt;p&gt;Launch the Vagrantfile using a code editor. In this tutorial, I'm using Visual Studio Code.&lt;br&gt;
Edit the file by adding the following code:&lt;/p&gt;

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

&lt;span class="no"&gt;Vagrant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;


&lt;span class="c1"&gt;### Nginx VM ###&lt;/span&gt;
  &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt; &lt;span class="s2"&gt;"web01"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;box&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ubuntu/bionic64"&lt;/span&gt;
    &lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hostname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"web01"&lt;/span&gt;
    &lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt; &lt;span class="s2"&gt;"private_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;ip: &lt;/span&gt;&lt;span class="s2"&gt;"192.168.56.18"&lt;/span&gt;
    &lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"vmware_desktop"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
      &lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gui&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
      &lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;allowlist_verified&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;end&lt;/span&gt;  


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

&lt;/div&gt;

&lt;p&gt;Let me explain what the file does. This Vagrant configuration file specifies a virtual machine with the name "web01" that will run an Ubuntu Bionic 64-bit operating system. Here's what each line does:&lt;/p&gt;

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

&lt;span class="no"&gt;Vagrant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Starts the Vagrant configuration block and specifies that version 2 of the configuration API should be used.&lt;/p&gt;

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

&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt; &lt;span class="s2"&gt;"web01"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Creates a new virtual machine named &lt;code&gt;web01&lt;/code&gt; and defines its settings.&lt;/p&gt;

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

&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;box&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ubuntu/bionic64"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Sets the base box image to &lt;code&gt;ubuntu/bionic64&lt;/code&gt;.&lt;/p&gt;

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

&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hostname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"web01"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Sets the hostname of the virtual machine to &lt;code&gt;web01&lt;/code&gt;.&lt;/p&gt;

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

&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt; &lt;span class="s2"&gt;"private_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;ip: &lt;/span&gt;&lt;span class="s2"&gt;"192.168.56.18"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Adds a private network interface to the virtual machine with an IP address of &lt;code&gt;192.168.56.18&lt;/code&gt;.&lt;/p&gt;

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

&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"vmware_desktop"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Sets the virtualization provider to &lt;code&gt;vmware_desktop&lt;/code&gt; and defines its settings.&lt;/p&gt;

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

&lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gui&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Enables the GUI mode for the virtual machine.&lt;/p&gt;

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

&lt;span class="n"&gt;vmware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;allowlist_verified&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;serves as a setting that VMware box has been properly configured for allow list VMX settings. &lt;/p&gt;

&lt;p&gt;Finally, the &lt;code&gt;end&lt;/code&gt; tags closes the &lt;code&gt;Vagrant.configure&lt;/code&gt;, &lt;code&gt;config.vm.define&lt;/code&gt;, and the &lt;code&gt;Vagrant.configure&lt;/code&gt; blocks respectively.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: If the IP address "192.168.56.18" is already in use on your computer, you can select an alternative "IP" address.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Launch the virtual machine using:&lt;/p&gt;

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

vagrant up


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

&lt;/div&gt;

&lt;p&gt;This will take a few minutes to boot up the VM. Login to the web01 VM using the command:&lt;/p&gt;

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

vagrant ssh web01


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

&lt;/div&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%2F00b3tiue5zqhay7kelfk.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%2F00b3tiue5zqhay7kelfk.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your directory should change to &lt;code&gt;vagrant@web01:~$&lt;/code&gt; if successful just as in the image above.&lt;/p&gt;

&lt;p&gt;Verify Hosts entry&lt;/p&gt;

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

cat /etc/hosts


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

&lt;/div&gt;

&lt;p&gt;Update the Ubuntu operating system with the latest patches by running the following commands:&lt;/p&gt;

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

sudo apt update
sudo apt upgrade


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

&lt;/div&gt;

&lt;p&gt;Install Nginx:&lt;/p&gt;

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

sudo apt install nginx -y


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

&lt;/div&gt;

&lt;p&gt;After installing Nginx, let's check that it's up and running with the command:&lt;/p&gt;

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

systemctl status nginx


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

&lt;/div&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%2Fyfx5wxws1nxnpxdv4t7z.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%2Fyfx5wxws1nxnpxdv4t7z.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The nginx web server is active (running) as seen in the image above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessing Nginx Web Server on Browser
&lt;/h2&gt;

&lt;p&gt;After setting up our VM and installing Nginx, we can now access our web server in a browser using the private IP address that we previously defined in our Vagrantfile.&lt;/p&gt;

&lt;p&gt;To confirm that our virtual machine's network setting is as specified in the Vagrantfile, which is &lt;code&gt;ip: 192.168.56.18&lt;/code&gt;. Inside the SSH session, run:&lt;/p&gt;

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

ip addr


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

&lt;/div&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%2F7oiift3cebre25pf2ngw.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%2F7oiift3cebre25pf2ngw.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should have an output similar to the one seen in the image above. The output verifies that the VM’s IP address is set to &lt;code&gt;192.168.56.18&lt;/code&gt; and we can access the web server in our browser using the IP address.&lt;br&gt;
Open your browser and enter “http:// Your IP ADDRESS”. For instance, &lt;code&gt;http://192.168.56.18&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%2Fk1dsfnh626t79xb2mpg0.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%2Fk1dsfnh626t79xb2mpg0.png" alt="nginx web page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Nginx Demo Page
&lt;/h2&gt;

&lt;p&gt;Good job if you've made it this far.The default Nginx page serves as a confirmation that Nginx is installed and running correctly. In the next section, We'll explore the steps in replacing the default Nginx page with our website so that users can see our content right away.&lt;/p&gt;

&lt;p&gt;You can change the appearance of the Nginx demo page by modifying the default &lt;code&gt;index.html&lt;/code&gt; file. To edit the file, run the following commands:&lt;/p&gt;

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

cd /var/www/html
ls -al


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

&lt;/div&gt;

&lt;p&gt;This will  cd into the /var/www/html directory and  list all the files in the directory&lt;br&gt;
You’ll see a file called &lt;code&gt;index.html&lt;/code&gt; or as in my case &lt;code&gt;index.nginx-debian.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use nano editor to edit the file:&lt;/p&gt;

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

sudo nano index.nginx-debian.html
or
sudo nano index.html


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

&lt;/div&gt;

&lt;p&gt;Your output should look like this:&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%2F0fcr5gek5h8f4b8zhvkl.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%2F0fcr5gek5h8f4b8zhvkl.png" alt="nginx terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can proceed to edit the page to give it the appearance you desire. As an example, you can either add a background color or an image. Press &lt;code&gt;ctrl+o&lt;/code&gt; to save the edited file, and &lt;code&gt;ctrl+x&lt;/code&gt; to close the nano editor. Type &lt;code&gt;logout&lt;/code&gt; to exit the Ubuntu virtual machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replace the Default Page with your Website
&lt;/h2&gt;

&lt;p&gt;We will upload an actual website in place of the default Nginx page in this section. The source code for this tutorial can be accessed via a &lt;a href="https://github.com/Roseline-Bassey/Vagrant-Project" rel="noopener noreferrer"&gt;GitHub link&lt;/a&gt;. I have modified &lt;a href="https://github.com/flexdinesh/dev-landing-page" rel="noopener noreferrer"&gt;Dinesh Pandiyan&lt;/a&gt;’s simple html and css open source landing page to make it uniquely mine. You can personalize this as well.&lt;/p&gt;

&lt;p&gt;Create a new folder called &lt;code&gt;samplepage&lt;/code&gt; in the &lt;code&gt;myproject&lt;/code&gt; directory which we previously created. Make sure you’re in the root directory before executing this command:&lt;/p&gt;

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

mkdir samplepage


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

&lt;/div&gt;

&lt;p&gt;You can either clone the &lt;a href="https://github.com/Roseline-Bassey/Vagrant-Project" rel="noopener noreferrer"&gt;samplepage&lt;/a&gt; folder from GitHub or use your preferred web page content.&lt;/p&gt;

&lt;p&gt;Run the following commands:&lt;/p&gt;

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

vagrant ssh web01


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

&lt;/div&gt;

&lt;p&gt;to move inside the virtual machine.&lt;br&gt;
Inside the virtual machine, run the following:&lt;/p&gt;

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

cd /vagrant
ls
sudo cp -r /vagrant/samplepage/* /var/www/html/


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

&lt;/div&gt;

&lt;p&gt;When you start a Vagrant virtual machine, a shared folder is created between the two machines, which is mapped to the &lt;code&gt;/vagrant&lt;/code&gt; directory in the guest machine. Any files or directories placed in your project directory on the host machine are automatically synced to the &lt;code&gt;/vagrant&lt;/code&gt; directory in the guest machine. This means that Vagrant shares our project folder (myproject) with the guest machine so we can access it from within the VM.&lt;/p&gt;

&lt;p&gt;In the code above: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cd /vagrant&lt;/code&gt; - This command changes the current working directory to /vagrant.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ls&lt;/code&gt; - This command lists and displays the names of all files and directories in the current directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo cp -r /vagrant/samplepage/* /var/www/html/&lt;/code&gt; - This command copies all files and directories inside the &lt;code&gt;/vagrant/samplepage/&lt;/code&gt; directory to the &lt;code&gt;/var/www/html/&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;I had changed my IP address from 192.168.56.18 to 192.168.56.19 when I encountered an error that says: 'The specified host network collides with a non-hostonly network! This will cause your specified IP to be inaccessible. Please change the IP or name of your host only network so that it no longer matches that of a bridged or non-hostonly network.' You do not have to do this excerpt you had the same issue when trying to vagrant up.&lt;/em&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%2F8p8b478jatkvmn4clzr0.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%2F8p8b478jatkvmn4clzr0.png" alt="web page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've made it this far, you should be proud of your accomplishments. You may view the demo web page by clicking &lt;a href="https://tranquil-gumption-58f2c5.netlify.app/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The next step is to automate this process so we don't have to manually provision the web server every time we execute 'vagrant up'. &lt;/p&gt;

&lt;h2&gt;
  
  
  Vagrant Automation
&lt;/h2&gt;

&lt;p&gt;In this section, we'll automate the entire process of setting up a virtual machine, installing a web server, and replacing the default Nginx web page with our actual web page. When we execute &lt;code&gt;vagrant up&lt;/code&gt;, our VM and Nginx web server will be provisioned automatically. To do this, we will write a bash script that will launch our virtual machine automatically.&lt;/p&gt;

&lt;p&gt;Create a new file called nginx.sh and add the following code to it:&lt;/p&gt;

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

&lt;span class="c"&gt;# installing nginx and copying file&lt;/span&gt;
apt update
apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; /vagrant/samplepage/&lt;span class="k"&gt;*&lt;/span&gt; /var/www/html/

&lt;span class="c"&gt;#starting nginx web server&lt;/span&gt;
systemctl start nginx
systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;nginx
systemctl restart nginx


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

&lt;/div&gt;

&lt;p&gt;Then, in your Vagrantfile, add the following code:&lt;/p&gt;

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

&lt;span class="n"&gt;web01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;provision&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;path: &lt;/span&gt;&lt;span class="s2"&gt;"nginx.sh"&lt;/span&gt; 


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

&lt;/div&gt;

&lt;p&gt;This code tells Vagrantfile to run a shell script named "nginx.sh" as part of its setup process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate your Vagrantfile
&lt;/h2&gt;

&lt;p&gt;To check that our Vagrantfile works as expected, we will validate it with &lt;/p&gt;

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

vagrant validate


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

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;This command should be executed outside of the ssh terminal.&lt;/em&gt;&lt;br&gt;
You should see an output like: “Vagrantfile validated successfully.” &lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;vagrant destroy&lt;/code&gt; to destroy the existing machine and &lt;code&gt;vagrant up&lt;/code&gt;  to start the VM with the automated configuration.&lt;/p&gt;

&lt;p&gt;Great job! You can now view your web page on the browser using the same IP address you specified in the Vagrantfile. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;To summarize, you’ve learned how to create a virtual machine and install Nginx on it. Provision a VM that runs a web server both manually and automatically. If you enjoy DevOps and Cloud computing tutorials, please hit the follow button and stop by frequently. &lt;/p&gt;

</description>
      <category>devops</category>
      <category>nginx</category>
      <category>virtualmachine</category>
      <category>docker</category>
    </item>
    <item>
      <title>Docker Terminologies</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Sat, 15 Oct 2022 06:41:02 +0000</pubDate>
      <link>https://dev.to/roselinebassey/docker-terminologies-3c3j</link>
      <guid>https://dev.to/roselinebassey/docker-terminologies-3c3j</guid>
      <description>&lt;p&gt;There's a good chance your first attempt at learning or using a new technology will be tough. This could happen if you’re not familiar with most terms or concepts. Technology such as Docker is an example of this. If you're new to it, its terms may seem confusing.&lt;/p&gt;

&lt;p&gt;For instance, if I were to explain Docker and containers to you, I would say: "Docker is a containerization platform that enables developers to create, deploy, and run applications in containers." "A container is a virtual environment that contains all the files and dependencies an application needs to run." &lt;/p&gt;

&lt;p&gt;In the explanations, terms such as "containerization," "containers," "virtual environment," and "dependencies" might make it difficult for a new user to understand.&lt;/p&gt;

&lt;p&gt;Because of this, it's helpful to understand some essential Docker terms if you're a new user. Your understanding of these terms will help reduce the time spent learning Docker. This blog post will cover some of the most frequently used Docker terminologies.&lt;/p&gt;

&lt;h1&gt;
  
  
  Docker Terminologies
&lt;/h1&gt;

&lt;p&gt;Every technology has its terms and concepts that are peculiar and Docker is not an exception. Docker has its own set of terminologies that are used by its users. We'll take a look at some of these terms in this part of the blog post. &lt;/p&gt;

&lt;p&gt;The following are some Docker terms:&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Host
&lt;/h3&gt;

&lt;p&gt;A Docker host is a computer on which Docker Desktop runs. It is a physical machine just like your laptop or a virtual machine. You need a Docker host to run Docker containers. All containers on the host machine share the same portion of the host kernel, which, therefore, makes all containers run in isolation from each other. &lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Desktop
&lt;/h3&gt;

&lt;p&gt;Docker Desktop is a Docker development environment. It is available for &lt;a href="https://docs.docker.com/glossary/#docker-desktop-for-mac"&gt;Mac&lt;/a&gt;, &lt;a href="https://docs.docker.com/glossary/#docker-desktop-for-windows"&gt;Windows&lt;/a&gt;, and &lt;a href="https://docs.docker.com/glossary/#docker-desktop-for-linux"&gt;Linux platforms&lt;/a&gt;. Docker Desktop includes Docker Engine, Docker CLI client, Docker Compose, Docker Content Trust, Kubernetes, and Credential Helper. &lt;/p&gt;

&lt;h3&gt;
  
  
  Docker client
&lt;/h3&gt;

&lt;p&gt;The Docker Client is the command line interface that you use to interact with Docker. It communicates with the Docker daemon via a REST API.  This communication is carried out on your terminal via your operating system. It sends requests through commands such as “pull”, “create”, and “stop” to &lt;code&gt;dockerd&lt;/code&gt; which responds in return. Docker Client can interact with Docker daemon available on a physical or virtual machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Daemon
&lt;/h3&gt;

&lt;p&gt;The Docker daemon is installed along with the Docker desktop. It is responsible for the building, running, and distributing of Docker containers. Docker demon consistently listens for API  requests from the Docker client to respond to. It manages Docker objects such as networks, storage, containers, and images. &lt;/p&gt;

&lt;h3&gt;
  
  
  Docker image
&lt;/h3&gt;

&lt;p&gt;A Docker image is an immutable (cannot be changed) file that includes everything needed to run an application. It is an instance or snapshot of a Docker container that can be used to create new containers. Docker images can be hosted as files on a private or public registry, such as Docker Hub.  Typically, an image is made up of several layers - the base layer and a layer of dependencies. Docker  Images are created using a Dockerfile. &lt;/p&gt;

&lt;h3&gt;
  
  
  Dockerfile
&lt;/h3&gt;

&lt;p&gt;A Dockerfile is a text file that contains instructions for building a Docker image. These instructions are written in a language called YAML, which stands for Yet Another Markup Language. It contains all the commands that can be used to create a container. A Dockerfile is a text file that contains all the commands needed to build a Docker image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Compose
&lt;/h3&gt;

&lt;p&gt;Docker Compose is a tool for defining and running multi-container Docker applications.  With Docker Compose, you can specify the services and configurations in a single YAML file that your application requires to run. Using Docker Compose you can easily spin everything up or down with a single command.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://dockerswarm.rocks/"&gt;Docker Swarm Mode&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Docker Swarm mode is a tool for orchestrating and managing Docker containers. It is integrated with Docker, so no additional installation is required. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://hub.docker.com/"&gt;DockerHub &lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This is a repository for Docker images. It is a cloud-based service that allows you to push and pull images. It is also a great place to find ready-made images for your applications. &lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Volumes
&lt;/h3&gt;

&lt;p&gt;These are used to persist data generated by a container. Volumes are stored on the Docker host and are not part of the container image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Server
&lt;/h3&gt;

&lt;p&gt;Docker server is the heart of the Docker platform. It is responsible for managing and running Docker containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Deployment
&lt;/h3&gt;

&lt;p&gt;This is the process of installing and running an application on a local machine. In relation to Docker, it refers to the process of installing and running Docker locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Production:
&lt;/h3&gt;

&lt;p&gt;The process of installing and running an application in an environment that is used by end users. &lt;br&gt;
Production deployments are used for live applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Network
&lt;/h3&gt;

&lt;p&gt;This is a type of network that is created by the Docker daemon and used by containers to communicate with each other. &lt;/p&gt;

&lt;h3&gt;
  
  
  Orchestrator
&lt;/h3&gt;

&lt;p&gt;An orchestrator is a tool or software that is used to manage a group of Docker containers. Two popular ones are Docker Swarm and Kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cluster
&lt;/h3&gt;

&lt;p&gt;A group of machines that are used to run containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Namespace
&lt;/h3&gt;

&lt;p&gt;A way to divide a cluster into multiple virtual clusters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Service
&lt;/h3&gt;

&lt;p&gt;A service is a group of containers that share the same image and provide the same functionality. Services are typically used to deploy and scale applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Repository
&lt;/h3&gt;

&lt;p&gt;A repository is a collection of Docker images. Docker Hub is a popular repository that offers a wide variety of images.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tag
&lt;/h3&gt;

&lt;p&gt;A tag is a label that is applied to a Docker image. Tags are used to identify images and can be used to specify versions or variants of an image&lt;/p&gt;

&lt;h3&gt;
  
  
  Build
&lt;/h3&gt;

&lt;p&gt;This is the process of creating a Docker image from a Dockerfile. &lt;/p&gt;

&lt;h1&gt;
  
  
  conclusion
&lt;/h1&gt;

&lt;p&gt;The blog post explained some Docker terms commonly used. Additionally, &lt;/p&gt;

</description>
      <category>docker</category>
      <category>microservices</category>
      <category>devops</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Technical Writer's Toolkit.</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Fri, 14 Oct 2022 11:23:48 +0000</pubDate>
      <link>https://dev.to/roselinebassey/technical-writers-toolkit-23i1</link>
      <guid>https://dev.to/roselinebassey/technical-writers-toolkit-23i1</guid>
      <description>&lt;p&gt;If you’re new to creating technical content, you'll find that structuring your content in a way that's accessible and communicative might be challenging. You may be wondering what tools you should use as a technical writer.&lt;br&gt;
The following are 10 content creation tools that'll help you create engaging content as a technical content creator:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Madcap Flare &lt;/li&gt;
&lt;li&gt;Camtasia &lt;/li&gt;
&lt;li&gt;Sangit &lt;/li&gt;
&lt;li&gt;Sphinx &lt;/li&gt;
&lt;li&gt;Grammarly...&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The complete list of tools to add to your toolkit as a technical writer can be found here: &lt;a href="https://aviyel.com/post/3800/10-content-creation-tools-every"&gt;https://aviyel.com/post/3800/10-content-creation-tools-every&lt;/a&gt;...&lt;/p&gt;

&lt;h1&gt;
  
  
  hacktoberfest2022 x Aviyel
&lt;/h1&gt;

</description>
      <category>hacktoberfest</category>
      <category>aviyel</category>
    </item>
    <item>
      <title>Basic Docker Commands for Beginners.</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Mon, 11 Jul 2022 16:18:18 +0000</pubDate>
      <link>https://dev.to/roselinebassey/docker-for-beginners-basic-docker-commands-2n89</link>
      <guid>https://dev.to/roselinebassey/docker-for-beginners-basic-docker-commands-2n89</guid>
      <description>&lt;p&gt;The first part of this article introduces you to Docker, monolithic and microservice architecture, virtual environment, and containers. &lt;/p&gt;

&lt;p&gt;With this general knowledge of Docker and containers, it's time to jump right into running applications in containers. &lt;/p&gt;

&lt;p&gt;If you're just getting started with Docker, you'll learn some practical Docker commands in this post that will let you pull and run a Docker image locally, start and stop a container, list all currently running containers, and debug containers.&lt;/p&gt;

&lt;p&gt;This blog post also provides some background information that will clarify the precise difference between a container and a Docker image.&lt;/p&gt;

&lt;p&gt;To get the most out of this post, ensure to practice each step to get a feel for working with applications in Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Docker&lt;/strong&gt;&lt;br&gt;
Before you begin you should have Docker installed and running. If you haven’t, please see Docker’s official documentation on how to install Docker and make sure to install the stable version. Docker can be installed on &lt;a href="https://docs.docker.com/desktop/linux/install/" rel="noopener noreferrer"&gt;Linux&lt;/a&gt;, &lt;a href="https://docs.docker.com/desktop/windows/install/" rel="noopener noreferrer"&gt;Windows&lt;/a&gt;, and &lt;a href="https://docs.docker.com/desktop/mac/install/" rel="noopener noreferrer"&gt;macOS&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Terminal&lt;/strong&gt;&lt;br&gt;
Launch your preferred terminal, which could be Terminal on Mac, a Bash shell on Linux, or PowerShell on Windows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a DockerHub Account&lt;/strong&gt;&lt;br&gt;
DockerHub is a public registry where applications are published.  DockerHub is like GitHub but for Docker images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internet connection&lt;/strong&gt;&lt;br&gt;
You'll need an internet connection for some commands to execute.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;The Difference Between  Docker image and Container&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Docker image&lt;/strong&gt; is simply a file that represents a container. For example, when you package an application with all its dependencies and push it to DockerHub or your private registry, the file in the registry is an image that represents your container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A container&lt;/strong&gt; can be viewed as a "box". In this box is an application that is packaged with its dependencies needed to run the application. &lt;/p&gt;

&lt;p&gt;This application has its distinct virtual environment- the hostname, disk, and IP address, which is managed by Docker. The application inside the box cannot have any interaction with the outside environment.  &lt;/p&gt;

&lt;p&gt;The box is called the container because it contains the application with its dependencies. Containers share the host operating system (OS), CPU, and memory. &lt;/p&gt;

&lt;p&gt;A container is an instance of a Docker image and a running environment of an image.&lt;/p&gt;

&lt;p&gt;To understand exactly the difference between container and image let's practice some commands.&lt;/p&gt;

&lt;p&gt;This tutorial uses redis for illustration. You could choose to use a different image or container and it'll still work the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker pull&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker pull IMAGE NAME&lt;/p&gt;

&lt;p&gt;docker pull is used to download or pull an image from the repository to your local machine. To access an image locally you must pull it first.&lt;/p&gt;

&lt;p&gt;let's pull a redis image from DockerHub to our local machine.&lt;/p&gt;

&lt;p&gt;Search for Redis in the search bar and click on the image. &lt;br&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%2F735ezthbih7asiteea09.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%2F735ezthbih7asiteea09.png" alt="What is docker DockerHub"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In your terminal, run the following command: &lt;code&gt;docker pull redis&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%2F1jv9ja8aqscsdhi7c6ni.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%2F1jv9ja8aqscsdhi7c6ni.png" alt="What is docker pull"&gt;&lt;/a&gt;&lt;br&gt;
The image is pulled, downloaded, and extracted by Docker when you run the command.&lt;/p&gt;

&lt;p&gt;The application package consists of six layers coupled together to run the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The latest tag is automatically pulled when you pull an image without specifying a tag. A tag is the same as a version.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker images&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To ensure that the image has been downloaded, run the following command in your terminal &lt;code&gt;docker images&lt;/code&gt;. This will list all existing images. &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%2Fayvpml0hcdouub03xrjc.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%2Fayvpml0hcdouub03xrjc.png" alt="what is a docker image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above, there's just one image with the REPOSITORY-redis, TAG-latest, image ID, when it was CREATED, and SIZE of the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You could specify a version or tag if you don't want Docker to download the default tag.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Tag&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You could specify the image tag by running the command &lt;code&gt;docker pull redis:10.1.&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;10.1&lt;/strong&gt; is the version specified. Remember the version is always followed after a semicolon.&lt;/p&gt;

&lt;p&gt;Now, you need to get redis running to make it reachable by your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker run&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker run IMAGE NAME&lt;/p&gt;

&lt;p&gt;The run command is used to create a container of an image. The first time you use the run command, Docker informs you that the image doesn't exist locally so it'll search for it on DockerHub, pulls and starts the image.&lt;/p&gt;

&lt;p&gt;If the image already exists locally, docker goes ahead to run a container of the image.&lt;/p&gt;

&lt;p&gt;But if the image doesn't exist in DockerHub or your local machine, you'll get no error message from Docker.&lt;/p&gt;

&lt;p&gt;At the point at which the image is running, the image is no more regarded as an image but as a container. &lt;/p&gt;

&lt;p&gt;To run the just downloaded image, use &lt;code&gt;docker run redis&lt;/code&gt;. It'll run a container called redis.&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%2Fnr81c044ft0cs26fjsra.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%2Fnr81c044ft0cs26fjsra.png" alt="how to use docker run"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above image, the docker run command starts the redis image in a container.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker run -d&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage:  docker run [OPTIONS]  IMAGE NAME&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%2Fzjxwor1doe2jik6mfe26.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%2Fzjxwor1doe2jik6mfe26.png" alt="how to use docker run -d"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-d&lt;/code&gt; is one of several docker run options. It is used to run a container in a detached mood.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker ps&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;docker ps&lt;/code&gt; command lists all running containers. This command allows you to track your container’s progress. If you ever get an empty list from running the command, ensure that your container is running.&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%2Fger7ragwtyal2saxzov1.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%2Fger7ragwtyal2saxzov1.png" alt="what is docker ps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You could use a separate terminal window to run the container and another for the docker ps command. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker ps -a&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker ps [OPTIONS]&lt;/p&gt;

&lt;p&gt;Several options could be used with the docker ps command such as &lt;code&gt;-a&lt;/code&gt;, &lt;code&gt;-f&lt;/code&gt;, &lt;code&gt;-s&lt;/code&gt;, etc. For instance, the &lt;code&gt;-a&lt;/code&gt; option lists all the exited and running containers. This allows you to track the status of a container. Run the command &lt;code&gt;docker ps -a&lt;/code&gt; to view all your containers.&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%2Fnn7aook7xd2xnxwaiss7.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%2Fnn7aook7xd2xnxwaiss7.png" alt="docker ps -a explained"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This image shows all containers in their current status.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker stop&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker stop CONTAINER ID&lt;/p&gt;

&lt;p&gt;Containers can be terminated by using the stop command. There are several reasons why you may want to stop a container. &lt;/p&gt;

&lt;p&gt;An error or a crash might require you to stop a container. You'll need the ID of the container that you want to stop.&lt;br&gt;
In your terminal run &lt;code&gt;docker stop "Container ID"&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%2F2v0nyu7qgfv1qojct2zk.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%2F2v0nyu7qgfv1qojct2zk.png" alt="docker stop command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;docker start&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Usage: docker start CONTAINER ID&lt;/p&gt;

&lt;p&gt;Using this command, you can restart a stopped container. You can do this by running the docker start "container ID" command.&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%2Fozicb2ku48j2v51yqlcx.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%2Fozicb2ku48j2v51yqlcx.png" alt="docker start command"&gt;&lt;/a&gt;&lt;br&gt;
The container specified will be started with this command.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Working With Containers&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The next part of this blog post will walk you through the steps and basic commands of working with a running container. For your application to connect to the container, the container must be reachable. &lt;/p&gt;

&lt;p&gt;To connect the container to your application, you'll need to bind the host port to the container’s port. The diagram below illustrates how host binding works.&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%2F2r8hqakoeff97tia6kp1.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%2F2r8hqakoeff97tia6kp1.png" alt="how to bind the host and container ports in docker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A host port is a port on your computer that your container binds to. Whereas, a container's port is a port on which the container runs and is used to access the services or dependencies inside the container.&lt;/p&gt;

&lt;p&gt;For instance, the port of the container below is &lt;strong&gt;6379/tcp&lt;/strong&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%2Fygwes8x8udlb9xr9hlu4.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%2Fygwes8x8udlb9xr9hlu4.png" alt="what is a container port in docker"&gt;&lt;/a&gt;&lt;br&gt;
You must first specify the host port before binding the port of the container to it&lt;/p&gt;

&lt;p&gt;Execute the following command in your terminal: &lt;code&gt;docker run -p8080:6379 redis&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%2F5qj8lx4rbumk5bsf8b13.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%2F5qj8lx4rbumk5bsf8b13.png" alt="how to bind a host port to redid container port in docker"&gt;&lt;/a&gt;&lt;br&gt;
The &lt;code&gt;-p&lt;/code&gt; flag in the command means port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Before executing the command, make sure the container has been stopped.&lt;/p&gt;

&lt;p&gt;To check that the host and the container's port have been connected, let's run the &lt;code&gt;docker ps&lt;/code&gt; command.&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%2Fj0x94rzn6xd2kc01cu47.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%2Fj0x94rzn6xd2kc01cu47.png" alt="docker ps command explained"&gt;&lt;/a&gt;&lt;br&gt;
In the image above the host’s port &lt;strong&gt;0.0.0.0:8080&lt;/strong&gt; has been connected to the container’s port &lt;strong&gt;6379/tcp&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker logs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker logs [OPTIONS] CONTAINER ID&lt;/p&gt;

&lt;p&gt;You can look through a container's logs using this command. It is utilized to debug or troubleshoot containers.&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%2Fuyhfewn0veizvfpm8cr8.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%2Fuyhfewn0veizvfpm8cr8.png" alt="how to use docker logs command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This command is only functional for containers that are started with the json-file or journald logging driver. -- Docker&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker exec&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker exec [OPTIONS]  CONTAINER ID /bin/bash&lt;/p&gt;

&lt;p&gt;This command is used to access a container's terminal. In the container's terminal, you could navigate directories and issue commands just like on your command line.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;docker exec -it "container ID" /bin/bash&lt;/code&gt;, for instance, to access the redis container terminal.&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%2F1xqupfeq61leoh0tdlns.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%2F1xqupfeq61leoh0tdlns.png" alt="docker exec command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-it&lt;/code&gt; flag means interactive and indicates that you would like to assess the terminal inside the container.&lt;/p&gt;

&lt;p&gt;In the first line, we executed the command and got access to the root directory. In the second line, the &lt;code&gt;pwd&lt;/code&gt; command lists our working directory. We navigate to the directory in line 3 and use the &lt;code&gt;ls&lt;/code&gt; command in line 4 to list all the directories inside the root directory -- &lt;code&gt;/data&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;docker rm&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Usage: docker rm [OPTIONS] CONTAINER ID&lt;/p&gt;

&lt;p&gt;If you want to clean up or remove containers or application packages  after following the exercises, you can run this command: &lt;code&gt;docker rm -f CONTAINER ID&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%2Fycql57rp2nlc8q1lfs5n.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%2Fycql57rp2nlc8q1lfs5n.png" alt="docker rm or remove command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this blog post, you’ve practiced working with basic Docker commands such as pull, run – which pulls and launches an image, stop, start, logs, exec, rm, etc. You learned how to bind a host and container ports as well as the difference between container and Docker image.&lt;/p&gt;

&lt;p&gt;In addition to the Docker commands that were covered in this article, there are many others that you might want to look into. If you'd like to learn more about the Docker command line, please use the link in the resource section.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Resources:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/roselinebassey/introducing-docker-concepts-containers-and-more-17hc"&gt;Introducing Docker Concepts, Containers and More.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/engine/reference/commandline/cli/" rel="noopener noreferrer"&gt;How to Use the Docker command line&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>beginners</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Tech Industry is Deep. Find Your Path and Stick With It.</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Sun, 10 Jul 2022 14:05:39 +0000</pubDate>
      <link>https://dev.to/roselinebassey/tech-industry-is-deep-find-your-path-and-stick-with-it-1d7l</link>
      <guid>https://dev.to/roselinebassey/tech-industry-is-deep-find-your-path-and-stick-with-it-1d7l</guid>
      <description>&lt;p&gt;This tech industry is so deep. Simply find your path and stick around with it.&lt;/p&gt;

&lt;p&gt;You'll be shocked at how much you've grown when you reflect on your progress over the next 12 months.&lt;/p&gt;

&lt;p&gt;Hey, let's get to hear about your journey.&lt;/p&gt;

&lt;p&gt;if you've just begun your tech journey, tell me, how has it been so far?&lt;/p&gt;

&lt;p&gt;To the experienced techies, what advice would you give to anyone just starting in tech?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introducing Docker Concepts, Containers, and more </title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Sat, 02 Jul 2022 20:33:50 +0000</pubDate>
      <link>https://dev.to/roselinebassey/introducing-docker-concepts-containers-and-more-17hc</link>
      <guid>https://dev.to/roselinebassey/introducing-docker-concepts-containers-and-more-17hc</guid>
      <description>&lt;p&gt;Containerization has rapidly gained popularity as a game-changing technology, enabling developers to package applications and their dependencies into self-contained units known as containers. Docker, with its user-friendly interface and powerful features, has emerged as the go-to solution for harnessing the full potential of containerization.&lt;/p&gt;

&lt;p&gt;Throughout this article, we will demystify the core concepts of containerization, shed light on the remarkable benefits it offers, and zoom in on Docker's architecture and key components. We will delve into the difference between Docker and virtual machines, and containers themselves, where applications run in isolation, providing enhanced scalability, flexibility, and efficiency.&lt;br&gt;
Before then, let's learn about Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Docker?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker is an open-source containerization platform used to build, test, manage, and deploy applications in a cloud-based environment.&lt;/p&gt;

&lt;p&gt;Docker provides a way to package an application into a "container," which can be run from any machine that has the Docker software installed. It makes it easy for you to run an application across different machines or environments.&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%2F2p1j7th7u60auwza5lsz.jpg" 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%2F2p1j7th7u60auwza5lsz.jpg" alt="How to get started with Docker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As organizations shift toward cloud-native and hybrid development, Docker is rapidly becoming the preferred tool for building and sharing containerized apps. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Origin of Docker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker was first released in 2013 and has since become one of the most popular tools for developers. The idea for Docker came about when Solomon Hykes, the creator of Docker, was working on a project at dotCloud, a cloud hosting provider.&lt;/p&gt;

&lt;p&gt;The project required him to use many different virtual machines, each with different versions of the same software. This was difficult to manage and ended up being very time-consuming.&lt;/p&gt;

&lt;p&gt;To make his life easier, Solomon created a tool that would enable him to package an application and its dependencies into a single container.&lt;/p&gt;

&lt;p&gt;This way, he could easily move the application between different machines without having to worry about compatibility issues.&lt;/p&gt;

&lt;p&gt;Docker makes it easy for developers to create, deploy, and run applications in a consistent environment, without the need to worry about differences between machines.&lt;/p&gt;

&lt;p&gt;Docker has since gained popularity and saw more support from commercial companies such as Amazon and Microsoft, further bolstering its credibility in the container management market. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How Did it Become so Popular?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker became popular because it offered a way to package an application with all its dependencies into a “container”. &lt;/p&gt;

&lt;p&gt;The containers are portable and can be run on any machine that has the Docker runtime installed. It also provided a way to share these containers using Docker Hub, which is like GitHub but for Docker images.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Problem Before Docker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the past, developing and deploying software applications has been a time-consuming and error-prone process. &lt;br&gt;
This is because each application has its dependencies and configurations, which can often conflict with other applications.&lt;/p&gt;

&lt;p&gt;Traditionally, applications are built on a type of architecture called monolithic. In monolithic architecture, all components of an application are packaged together in one large program. &lt;/p&gt;

&lt;p&gt;Each line of code, libraries, and dependencies is connected to one another–meaning that each layer of the application is built on top of each other which often creates a series of problems.&lt;/p&gt;

&lt;p&gt;In traditional methods, code is developed in a specific computing environment which, when transferred to a new location, often results in bugs and errors.&lt;/p&gt;

&lt;p&gt;One of the most likely problems developers complain about is the "it works on my machine" problem. With Docker, developers can collaborate on projects without fear of breaking each other's code. &lt;/p&gt;

&lt;p&gt;Imagine you are part of a developer's team and you are working on a Javascript application that requires PostgreSQL and Redis for messaging.&lt;/p&gt;

&lt;p&gt;You'll need to install these services directly on your operating system. For any developer within your team to deploy the app, they must install binaries of these services, configure them, and run them locally.&lt;/p&gt;

&lt;p&gt;Installation may look very different depending on which operating system is used and may involve many steps that need to be performed, and perhaps something could turn out wrong. &lt;/p&gt;

&lt;p&gt;This process can be frustrating, and costly, and you may have some difficulty scaling and deploying applications.&lt;/p&gt;

&lt;p&gt;Deploying and packaging apps in a reliable and repeatable way has always been a pain point. &lt;/p&gt;

&lt;p&gt;According to Rob Vettor and Steve “ardalis” in &lt;em&gt;, Architecting Cloud-Native .NET Apps for Azure&lt;/em&gt;, some of the problems you could face using this architecture include:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The app has become so overwhelmingly complicated that no single person understands it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You fear making changes - each change has unintended and costly side effects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New features/fixes become tricky, time-consuming, and expensive to implement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each release becomes as small as possible and requires the full deployment of the entire application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One unstable component can crash the entire system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New technologies and frameworks aren’t an option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Its difficult to implement agile delivery methodologies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Architectural erosion sets in as the code base deteriorates with never-ending “quick fixes.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, the consultants come in and tell you to rewrite it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Due to this, many organizations have shifted to adopting a cloud-native approach to building containerized applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Containerization&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Containerization eliminates these problems by bundling the application code together with the related configuration files and dependencies, making it easy to deploy and run in any environment.&lt;/p&gt;

&lt;p&gt;Containerization is a type of virtualization that allows you to run multiple applications on a single server. This can be extremely beneficial for businesses, as it can help to save on server costs and increase efficiency.&lt;/p&gt;

&lt;p&gt;Containerization has many benefits, but one of the most important is that it eliminates the "it works on my machine" problem. &lt;/p&gt;

&lt;p&gt;This is because the container includes everything needed to run the application, so it will work the same in any environment. This is a huge benefit for software developers, as it makes it much easier to develop and test applications.&lt;/p&gt;

&lt;p&gt;If you're looking for a way to improve the development and deployment of your software, then containerization is a great option to consider.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Container&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Containers help simplify the process of deploying applications. Containers allow you to isolate each component or layer of an application from each other. It allows you to run different applications on the same host without them interfering with each other.&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%2Fg56mpepbfbjguvybrpf3.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%2Fg56mpepbfbjguvybrpf3.png" alt="what is containerization"&gt;&lt;/a&gt;&lt;br&gt;
Image source: Docker&lt;/p&gt;

&lt;p&gt;In the diagram above, each application(container) is isolated from other containers managed by Docker in your host operating system.&lt;/p&gt;

&lt;p&gt;Hence, the breakdown of one container does not affect the performance of another.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Benefits of Containers.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Some of the key benefits of containerization include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Containers are lighter and require fewer resources thereby, making them more efficient to run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers can be moved easily between environments, making them ideal for development and testing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Isolation between containers prevents one application from affecting another, improving stability and security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increased security, since container isolation prevents malicious code from infecting the underlying system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved performance, since containers do not need to be booted every time they are run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy to Use: Containerization is easy to set up and use, which can save you time and money.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalable: You can easily scale your containerized applications to meet the demands of your business.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Portable: You can move containerized applications between servers, which makes it easy to maintain and update them. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, containerization provides a more efficient and robust way to deploy applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Monolithic&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Monolithic software architecture is one in which all components are tightly coupled and interdependent. This type of architecture has been traditionally used for large-scale applications.&lt;/p&gt;

&lt;p&gt;The main disadvantage of a monolithic architecture is that it can be more difficult to maintain and modify. &lt;/p&gt;

&lt;p&gt;Because all components are tightly coupled, a change to one component can potentially break other components. In addition, monolithic architectures can be more difficult to scale than other architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Microservices&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Microservices refers to the practice by which applications are broken down into smaller pieces called “microservices” so they can be built individually and then wired together when needed.&lt;br&gt;
This allows for greater flexibility and scalability.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The difference between Docker and virtual machines&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker and virtual machines are both popular ways to organize and isolate applications.&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%2Fbour9cyw0gq9nexsm276.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%2Fbour9cyw0gq9nexsm276.png" alt="The difference between Docker and virtual machines"&gt;&lt;/a&gt;&lt;br&gt;
Image source: Medium&lt;/p&gt;

&lt;p&gt;Docker is a containerization platform that allows you to create and run isolated applications. With Docker, you can bundle your application into containers.&lt;/p&gt;

&lt;p&gt;Containers are lighter than virtual machines and can be spun up more quickly. They're also more portable since they can be deployed on any machine that supports Docker. &lt;/p&gt;

&lt;p&gt;Virtual machines are full-fledged operating systems that are run on top of a hypervisor. Virtual machines are also less portable than containers since they require specific hardware configurations.&lt;/p&gt;

&lt;p&gt;They're also heavier and take longer to spin up. They are isolated from each other, so an attacker who compromises one virtual machine cannot access other virtual machines on the same host.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Our discussion covered the basics that can help you get started with Docker, but you also learned about Docker as a whole, why Docker was created, and the problems it addresses. &lt;/p&gt;

&lt;p&gt;You also learned about containerization and how it makes it easier to deploy apps from desktops to the cloud. You learned about the benefits of using containers in app development. &lt;/p&gt;

&lt;p&gt;The difference between a virtual machine and Docker was also discussed, as well as monolithic and microservices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/roselinebassey/docker-for-beginners-basic-docker-commands-2n89"&gt;Learn more about Docker commands you'll frequently used as a beginner.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following resources will help you learn more about Docker:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Resources:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.redhat.com/en/topics/containers" rel="noopener noreferrer"&gt;Introduction to Container By Red Hat&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=3c-iBn73dDE" rel="noopener noreferrer"&gt;TechWorld with Nana - Docker Tutorial for Beginners&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=17Bl31rlnRM&amp;amp;list=WL&amp;amp;index=128&amp;amp;t=61s" rel="noopener noreferrer"&gt;Docker Tutorial for Beginners - What is Docker? Introduction to Containers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=pTFZFxd4hOI" rel="noopener noreferrer"&gt;Programming with Mosh - Docker Tutorial for Beginners&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>microservices</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Want to Be a Programmer?</title>
      <dc:creator>Roseline Bassey</dc:creator>
      <pubDate>Tue, 15 Mar 2022 15:53:44 +0000</pubDate>
      <link>https://dev.to/roselinebassey/an-introduction-to-programming-how-to-become-a-programmer-programming-html-css-tech-coding-1noo</link>
      <guid>https://dev.to/roselinebassey/an-introduction-to-programming-how-to-become-a-programmer-programming-html-css-tech-coding-1noo</guid>
      <description>&lt;p&gt;Most likely, you've heard your friends, family, or social media buddies talk about programming and its benefits. Alternatively, perhaps you are interested in working in a company such as Google, Amazon, Meta, etc., and would like to learn how to program so you can get your dream job with them.&lt;/p&gt;

&lt;p&gt;This blog post would provide you with an understanding of the basics of programming, as well as how you can start learning this valuable skill. I hope that after reading this post, you’ll be excited to start your programming journey!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Programming?&lt;/strong&gt;&lt;br&gt;
Programming is the process of writing instructions for a computer to follow. These instructions tell the computer how to carry out a task. For example, when you create a new Amazon account, you go through a set of instructions written by programmers. &lt;/p&gt;

&lt;p&gt;This is made possible by the programming code that tells the computer what to do. So, writing these instructions is called programming. They are written by programmers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who is a Programmer?&lt;/strong&gt;&lt;br&gt;
A programmer is somebody who writes code, or specific sets of instructions, that tell a computer what to do. They might create and design websites, develop desktop programs, build mobile apps, develop video games, create Artificial Intelligence algorithms, or perform statistical analysis - just to name a few possibilities. In other words, they make the computer do what they want it to.&lt;/p&gt;

&lt;p&gt;For example, they might write instructions that say ‘add the two numbers in cell A1 and cell B1, and put the answer in cell C1’. The computer will then follow those instructions and do exactly what the programmer has told it to do. In a sense, a programmer is like an artist who creates things with code. Programmers might work alone or in teams. They could be employed by companies or organizations that need their skills, or they could be self-employed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Language of the Computer&lt;/strong&gt;&lt;br&gt;
Just like you and I use language as a means of communicating our ideas, expressing our emotions and thoughts. Computers also make use of language to communicate. The computer language is defined as the syntax used to write specific applications. Its language is represented as binary digits 0’s and 1’s. The computer language can be classified into three categories:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High-level Language:&lt;/strong&gt;&lt;br&gt;
This is the language that is commonly understood by humans. A high-level language contains symbols and words familiar to humans. This kind of language is used by programmers in writing programs. Examples of high-level languages include BASIC, COBOL, Pascal, and C++.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assembly language:&lt;/strong&gt;&lt;br&gt;
This is a low-level computer programming language that makes use of mnemonic codes (Abbreviation of a longer name) to represent instructions. Examples of assembly languages include 8086, 8085, 8051, and PIC Microcontrollers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Machine language:&lt;/strong&gt; &lt;br&gt;
This is a low-level computer programming language that uses binary numbers to represent instructions. Instructions are represented in 0’s and 1’s that the computer understands and responds accordingly. For example, your first line of code could be a piece of code that displays &lt;strong&gt;“Hello World”&lt;/strong&gt; on your computer screen. The only reason why your computer responded with &lt;strong&gt;“Hello World”&lt;/strong&gt; text is that the compiler converts the programs to binary codes known as machine language.&lt;/p&gt;

&lt;p&gt;An example of machine language for the text &lt;strong&gt;“Hello World”&lt;/strong&gt; is interpreted this way:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           01001000 0110101 01101100 01101100
           01101111 00100000 01010111 01101111
           01110010 01101100 01100100.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;What Exactly is a Programming Language?&lt;/strong&gt;&lt;br&gt;
Programming language is a language that is understood by a computer. By receiving instructions written in the programming language, the computer acts, behaves, and executes according to the instructions.&lt;/p&gt;

&lt;p&gt;Programming languages come in a variety of types, and each has a specific function. Before you start programming, it's important to understand how different programming languages operate. Moreover, it is important to choose a language that matches your vision or goals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Programming Language:&lt;/strong&gt;&lt;br&gt;
Just like human language is diverse from nation to nation or even within a nation, so is the programming language. There are different types of programming languages available today. Some of them make it easy to read and write code while others help programmers in solving complex problems. That being said, let’s take a look at some of the most popular programming languages:&lt;br&gt;
JavaScript&lt;br&gt;
Java&lt;br&gt;
Python&lt;br&gt;
C++ etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Learn to Code&lt;/strong&gt;&lt;br&gt;
Learning programming languages is similar to learning foreign languages. While acquiring your first language may seem easy with no or less amount of effort, a second language requires you to pay attention to the language rules. For example, to learn how to be proficient in a given language one needs to pay keen attention to the grammatical rules or conventions that guide the language. &lt;/p&gt;

&lt;p&gt;So, learning to code is not far from this reality. Let's say for example you’re learning to write in JavaScript. You'll need to learn and get familiar with the syntax, its conventions, rules, etc. That way you’ll be able to write codes in JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Programming Language Should you Learn?&lt;/strong&gt;&lt;br&gt;
One of the most common questions asked by prospective programmers is what is the best programming language to learn? There is no absolute “best” language; each language has its strengths and weaknesses. Before choosing a programming language you should consider answering the following questions: &lt;/p&gt;

&lt;p&gt;Do you intend to build web apps?&lt;br&gt;
Do you want to develop Android apps or iOS apps?&lt;br&gt;
Do you have an eye for video games?&lt;br&gt;
Are you good at arranging data structures?&lt;br&gt;
Are you fascinated by building stuff with AI?&lt;/p&gt;

&lt;p&gt;Considering your answers to these questions you should have a clear guide to the type of languages required in your chosen field. However, it’s advisable at this point in your career that you focus on mastering a particular programming language. Don’t make the mistake of jumping from one language to another. Do you know why?  No company pays you for knowing all the programming languages in the world, they rather pay you for what problem you’re able to solve with a specific language. Therefore, choosing a language is dependent on your career path. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Starting with HTML and CSS&lt;/strong&gt;&lt;br&gt;
CSS and HTML are technically not programming languages, but they are an excellent place to begin when learning about how programming works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is HTML?&lt;/strong&gt;&lt;br&gt;
HTML is an acronym that stands for HyperText Markup Language and the latest version is HTML5. It defines how the web page contents can be displayed on different devices such as computers, tablets, phones, and other portable devices. HTML describes the structure of a Web page. &lt;/p&gt;

&lt;p&gt;It is the skeleton to which you build your page's content. It describes how text, links, and images will be formatted and displayed on a webpage. It consists of several elements and each element tells the browser how to display the content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Basic Structure of an HTML Document&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HoHQrgej--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijo1d1zyk9s7hoivs0h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HoHQrgej--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijo1d1zyk9s7hoivs0h4.png" alt="A basic structure of an HTML document" width="671" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Typically, an HTML document consists of 5 elements:&lt;/p&gt;

&lt;p&gt;1.&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/code&gt;&lt;br&gt;
The DOCTYPE declaration is used to specify which version of HTML the page is written on.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt;&lt;br&gt;
This is the root element of an HTML page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;br&gt;
The head element contains meta information of the page that isn’t displayed directly on the Web page. &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; element provides additional information such as page keywords, page description, and the author(s) of a web document.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;title&amp;gt;My New HTML Page&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;br&gt;
The title element defines the title of the page. It is displayed in a Web browser’s title bar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;br&gt;
The body element contains Web page content such as texts, videos, images, links, etc. that are visible.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;HTML Elements and Attributes&lt;/strong&gt;&lt;br&gt;
HTML tags or elements, and attributes are the building blocks of HTML and are used to create dynamic and responsive web pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Elements&lt;/strong&gt;&lt;br&gt;
An element consists of an opening and closing tag with the content inserted in between. It is enclosed by angle brackets but with a forward slash inserted before the end tag. For example, the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; element is used to create a paragraph.&lt;br&gt;
&lt;code&gt;&amp;lt;p&amp;gt;My first paragraph.&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attributes&lt;/strong&gt;&lt;br&gt;
An attribute provides additional information about an element. Attributes are written within the opening tag. It is made up of a name and a value. The value of an attribute is inserted within quotation marks like in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IVEyrLJR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbt3r3pnmfsaxnokryuk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IVEyrLJR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbt3r3pnmfsaxnokryuk.png" alt="An example of HTML element and attribute" width="462" height="26"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File Naming Conventions&lt;/strong&gt;&lt;br&gt;
While there is no standard way to name your HTML and CSS files, there is a standard extension suffix that should follow your file name. HTML files must end in &lt;code&gt;.html&lt;/code&gt; while CSS files must end in &lt;code&gt;.css&lt;/code&gt; just like in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mZk_rj6_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fn883615svfyy3otslt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mZk_rj6_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fn883615svfyy3otslt.png" alt="An image displaying HTML and CSS file naming format" width="160" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is CSS?&lt;/strong&gt; &lt;br&gt;
CSS, or Cascading Style Sheets, is a common language used to define the style of a page. It defines the visual appearance of a site. CSS is used by your browser to design the layout and style of your web page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding CSS Style Guide: Inline, and External Style Guide&lt;/strong&gt;&lt;br&gt;
The CSS style guide defines how CSS elements create different layouts on any web page or platform. &lt;/p&gt;

&lt;p&gt;These are two types of CSS style guides: inline, and external.&lt;br&gt;
&lt;strong&gt;Inline:&lt;/strong&gt;&lt;br&gt;
Inline style means that the styling information is contained within your HTML source code itself. This approach is easy for most people to understand and maintain, but can lead to conflicting styles within your source code when developers work on different pages in a website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;External:&lt;/strong&gt; &lt;br&gt;
External style refers to styles that are located in an external file referred to as an external style sheet (or &lt;code&gt;.css&lt;/code&gt; file for short). These styles can usually be modified without affecting other files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools You Need to Start Programming&lt;/strong&gt;&lt;br&gt;
To start writing codes you’ll need a text editor. There are lots of them out there but I’ll recommend only a few.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://atom.io/"&gt;Atom:&lt;/a&gt; This is a free desktop text editor that allows you to work with Git and GitHub directly from Atom. It’s one of the best text editors. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/"&gt;Visual Studio Code:&lt;/a&gt; This is a code editor optimized for building and debugging modern web and cloud applications. It is free and easy to use. It has tons of plugins available to make work easier for you. The user interface is simple to understand and you’ll get used to it in no time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://notepad-plus-plus.org/"&gt;Notepad++:&lt;/a&gt; Notepad++ is a free source code editor that supports several languages. It runs in the MS Windows environment.             &lt;/p&gt;

&lt;p&gt;Aside from a text editor, you’ll need a browser too. Browsers help in reading and interpreting your codes. The following browsers are recommendable; Chrome, Firefox, Microsoft Edge, etc.&lt;/p&gt;

&lt;p&gt;You’ll also need a good working laptop and an internet connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where do I learn to program?&lt;/strong&gt;&lt;br&gt;
There are many ways to learn how to program. You can take courses at your local college or university, or you can take online courses on sites like Coursera, Udacity, Udemy, FreeCodeCamp, or Pluralsight. You can also teach yourself by reading books or watching tutorials on YouTube.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Overall, programming is a high-paying career that requires patience, dedication, and a great deal of attention to detail.&lt;br&gt;
It does not matter from which background you come, if you love learning new things and are willing to stay positive, you can succeed.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
