Changes between Version 1 and Version 2 of Csle2022/Agenda/Containers


Ignore:
Timestamp:
Oct 19, 2022, 7:27:56 AM (2 years ago)
Author:
dushmantha
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/Containers

    v1 v2  
    66'''Requirements:'''
    77
    8 Participants are requested to have a computer with Windows 8/10/11 (8GB RAM, 25GB free disk space) with Virtualbox (version 6 or higher) hypervisor and Putty installed.
     8Participants are requested to have a computer with Windows 8/10/11 (8GB RAM, 25GB free disk space) with Virtualbox (version 6 or higher) hypervisor and Putty installed.[[BR]]
     9
    910In Virtualbox, 'Extension pack' should be installed.
    1011
     
    2021Import the VM to Virtualbox.[[BR]]
    2122
    22 Username and Password:[[BR]]
     23Username and Password: '''docker''' [[BR]]
    2324
    2425May have to create Virtualbox Host-Only Network Adapter[[BR]]
    2526
     27
     28{{{
    2629File > Host Network Manager > Create
     30}}}
     31
    2732
    2833Test internet connectivity.[[BR]]
     
    3237== Docker Lab ==
    3338
    34 In this lab, you will setup docker and customize docker images.
     39In this lab, you will setup Docker and customize Docker images.
    3540
    3641'''Requirements:'''
    3742
    38 Participants are requested to have a computer with Windows 8/10/11 (8GB RAM, 25GB free disk space) with Virtualbox (version 6 or higher) hypervisor and Putty installed.
    39 In Virtualbox, 'Extension pack' should be installed.
    40 
    41 A wired internet connection is preferred.
     43Same as the above LXC lab.
    4244
    4345
    44 '''Virtual Machine (VM) Setup'''
     46'''VM Setup'''
    4547
    4648Download VM from the following Link.
     
    5052Import the VM to Virtualbox.[[BR]]
    5153
    52 Username and Password:[[BR]]
     54Username and Password: '''docker''' [[BR]]
    5355
    5456May have to create Virtualbox Host-Only Network Adapter[[BR]]
    5557
     58
     59{{{
    5660File > Host Network Manager > Create
     61}}}
    5762
    5863Test internet connectivity.[[BR]]
    5964
    6065Login using Putty.
     66
     67Login as root to the provided VM.
     68
     69'''Setup Docker'''
     70
     71
     72{{{
     73apt-get install -y docker.io
     74systemctl enable docker.service
     75}}}
     76
     77'''Managing Docker'''
     78
     79List Docker images
     80
     81
     82{{{
     83docker image ls
     84}}}
     85
     86
     87Docker image search
     88
     89
     90{{{
     91docker search <image name>
     92}}}
     93
     94
     95Download a Docker image
     96
     97
     98{{{
     99docker pull <image name>
     100}}}
     101
     102
     103List docker containers that are currently running
     104
     105
     106{{{
     107docker container ls
     108}}}
     109
     110
     111Run a Docker image
     112
     113
     114{{{
     115docker run -d --name <name> -p 80:80 -d <image name>
     116}}}
     117
     118
     119Stop a Docker container
     120
     121
     122{{{
     123docker stop <container name/ID>
     124}}}
     125
     126
     127Setup a Docker image
     128
     129
     130{{{
     131mkdir <directory name>
     132}}}
     133
     134
     135{{{
     136nano Dockerfile
     137}}}
     138
     139
     140
     141{{{
     142FROM php:8.0-apache
     143COPY index.php /var/www/html/
     144EXPOSE 80
     145CMD apachectl -D FOREGROUND
     146}}}
     147
     148
     149nano index.php
     150
     151{{{
     152
     153<!DOCTYPE html>
     154<html>
     155<body>
     156<?php
     157date_default_timezone_set("Asia/Colombo");
     158echo "The time is " . date("h:i:sa");
     159?>
     160</body>
     161</html>
     162}}}
     163
     164
     165
     166'''Docker Hub Account Setup'''
     167
     168 Go to https://hub.docker.com/signup [[BR]]
     169
     170 Create an account[[BR]]
     171
     172 Choose ‘Personal Plan’ (Continue with free) if asked[[BR]]
     173
     174 Create a '''Repository'''
     175
     176'''Build a Docker image'''
     177
     178
     179{{{
     180docker build . -t <Docker Hub username>/<repository name>:v1
     181}}}
     182
     183.
     184
     185
     186'''Share a Docker image'''
     187
     188
     189{{{
     190docker login -u <docker hub username>
     191docker push <docker hub username>/<respository name>:v1
     192docker logout
     193}}}
     194
     195