Skip to content
This repository was archived by the owner on Apr 21, 2020. It is now read-only.

kairops/docker-learning

Repository files navigation

DEPRECATED

Please visit https://github.com/ayudadigital/docker-learning

Docker Learning

Docker Learning Course

Duration: Two weeks, three days per each week, 1 hour per day

Week 1

Learning docker

Day 1

Inception with docker basics

  • Container execution and deatached execution
  • Images
    • Layers
    • tags
    • docker public registry
  • Builds
    • Dockerfile
    • Build, commit, push
  • CMD and ENTRYPOINT differences
  • Pets vs Cattle
  • Docker Development Flow

Reference repositories:

Day 2

Docker Elements

  • Containers
  • Images
  • Networks
  • Volumes

Refertence repositories:

Day 3

Docker Compose

  • Docker compose file
  • Parameters with .env
  • Platform definition and usage
  • Real examples with live projects

Reference repositories:

External resources:

Week 2

Using docker

Day 4

Docker compose in real projects

Reference repositories: none that we can share :)

Day 5

Choose one of the following options

Docker in depth

  • Docker in Docker
    • Ubuntu DIND
    • Official Docker in docker (official)
  • Quality pieces with Docker
    • Jenkins in docker
    • Sonar with real live project

Reference repositories:

Dockerize an application

Put docker on the Spring Boot Angular4 Heroes sample application.

Stages:

  1. Follow the instructions of the project and install on your workstation or laptop all the stuff to execute the application.
  2. Build a docker-compose platform in two services: database and application.
  3. Compare with the Kairops Fork of the project and the solution proposed here. Don't cheat and look only when you are finished the sedond stage.

Tips:

  • Use MySQL 5.x or MariaDB 5.x versions for the database service.
  • Use debian based image for the application service.
  • Add --disable-host-check and --host 0.0.0.0 parameters for the ng start command.

Top goal:

  • Try to split the application in two docker services: backend and frontend.

Day 6

BDD with Docker

Use the project Duing to dessign and execute a BDD test

Demonstrate how we can use Docker to run a complete linux Desktop environment with all the tools needed to materialize complex tasks.

Reference repositories:

Further reading

Stuff Intallation

You can download the whole docker images and clone the whole referenced repositories with a script within the project.

Execute the command:

devcontrol/actions/install-stuff.sh exec

...or use devcontrol install-stuff if you have Devcontrol installed on your system) and wait for the script to finish.

BDD examples

Find in the bdd-examples directory of the repository some examples of BDD test created as part of the day 6 session.

To execute the tests:

  1. Start a duing container with the repository shared as volume within it.

    docker run --name duing \
              -p 3389:3389 \
              --shm-size 1g \
              -dit --restart unless-stopped \
              -v $(pwd):/opt/docker-learning \
              kairops/duing
  2. Copy the /opt/docker-learning/bdd-examples/test/ directory in /opt/duingdemo/ci-scripts/test/. This will add the examples to the features directory.

    $ docker exec -u ubuntu duing cp -rv /opt/docker-learning/bdd-examples/test/ /opt/duingdemo/ci-scripts/
    '/opt/docker-learning/bdd-examples/test/cucumber/features/step_definitions/bddfire_steps.rb' -> '/opt/duingdemo/ci-scripts/test/cucumber/features/step_definitions/bddfire_steps.rb'
    '/opt/docker-learning/bdd-examples/test/cucumber/features/github_search.feature' -> '/opt/duingdemo/ci-scripts/test/cucumber/features/github_search.feature'
  3. Follow the instructions of the Duing project.

    Take care that github can't be tested with PhantomJS, so the rake poltergeist command will end with an error.

    ubuntu@7a0e1ec3060f:/opt/duingdemo/ci-scripts/test/cucumber$ rake poltergeist
    /usr/bin/ruby2.5 -S bundle exec cucumber features -p poltergeist --format pretty --profile html -t ~@api
    {"baseurl"=>"https://www.google.es", "take_screenshots"=>false, "screenshot_delay"=>1, "browser_width"=>1024}
    Using the poltergeist and html profiles...
    Feature: Google Search to explore BDDfire
    
      Scenario: View home page                      # features/bddfire.feature:4
        Given I am on "http://www.google.com?hl=en" # bddfire-3.0.2/lib/bddfire/web/web_steps.rb:2
        When I fill in "q" with the text "bddfire"  # bddfire-3.0.2/lib/bddfire/web/web_steps.rb:6
        Then I should see "Sign in"                 # bddfire-3.0.2/lib/bddfire/web/web_steps.rb:10
    
    Feature: Github search for a library
    
      Scenario: Search library within github                # features/github_search.feature:3
        Given I am on "https://www.github.com"              # bddfire-3.0.2/lib/bddfire/web/web_steps.rb:2
          Request to 'https://www.github.com' failed to reach server, check DNS and/or server status (Capybara::Poltergeist::StatusFailError)
          features/github_search.feature:4:in `Given I am on "https://www.github.com"'
        When I fill in "Search GitHub" with the text "vavr" # bddfire-3.0.2/lib/bddfire/web/web_steps.rb:6
        And I press intro key with my little finger         # features/step_definitions/bddfire_steps.rb:3
    
    Failing Scenarios:
    cucumber -p poltergeist -p html features/github_search.feature:3 # Scenario: Search library within github
    
    2 scenarios (1 failed, 1 passed)
    6 steps (1 failed, 2 skipped, 3 passed)
    0m1.410s