Changes between Version 1 and Version 2 of Csle2022/Agenda/Containers
- Timestamp:
- Oct 19, 2022, 7:27:56 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Csle2022/Agenda/Containers
v1 v2 6 6 '''Requirements:''' 7 7 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. 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.[[BR]] 9 9 10 In Virtualbox, 'Extension pack' should be installed. 10 11 … … 20 21 Import the VM to Virtualbox.[[BR]] 21 22 22 Username and Password: [[BR]]23 Username and Password: '''docker''' [[BR]] 23 24 24 25 May have to create Virtualbox Host-Only Network Adapter[[BR]] 25 26 27 28 {{{ 26 29 File > Host Network Manager > Create 30 }}} 31 27 32 28 33 Test internet connectivity.[[BR]] … … 32 37 == Docker Lab == 33 38 34 In this lab, you will setup docker and customize docker images.39 In this lab, you will setup Docker and customize Docker images. 35 40 36 41 '''Requirements:''' 37 42 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. 43 Same as the above LXC lab. 42 44 43 45 44 '''V irtual Machine (VM)Setup'''46 '''VM Setup''' 45 47 46 48 Download VM from the following Link. … … 50 52 Import the VM to Virtualbox.[[BR]] 51 53 52 Username and Password: [[BR]]54 Username and Password: '''docker''' [[BR]] 53 55 54 56 May have to create Virtualbox Host-Only Network Adapter[[BR]] 55 57 58 59 {{{ 56 60 File > Host Network Manager > Create 61 }}} 57 62 58 63 Test internet connectivity.[[BR]] 59 64 60 65 Login using Putty. 66 67 Login as root to the provided VM. 68 69 '''Setup Docker''' 70 71 72 {{{ 73 apt-get install -y docker.io 74 systemctl enable docker.service 75 }}} 76 77 '''Managing Docker''' 78 79 List Docker images 80 81 82 {{{ 83 docker image ls 84 }}} 85 86 87 Docker image search 88 89 90 {{{ 91 docker search <image name> 92 }}} 93 94 95 Download a Docker image 96 97 98 {{{ 99 docker pull <image name> 100 }}} 101 102 103 List docker containers that are currently running 104 105 106 {{{ 107 docker container ls 108 }}} 109 110 111 Run a Docker image 112 113 114 {{{ 115 docker run -d --name <name> -p 80:80 -d <image name> 116 }}} 117 118 119 Stop a Docker container 120 121 122 {{{ 123 docker stop <container name/ID> 124 }}} 125 126 127 Setup a Docker image 128 129 130 {{{ 131 mkdir <directory name> 132 }}} 133 134 135 {{{ 136 nano Dockerfile 137 }}} 138 139 140 141 {{{ 142 FROM php:8.0-apache 143 COPY index.php /var/www/html/ 144 EXPOSE 80 145 CMD apachectl -D FOREGROUND 146 }}} 147 148 149 nano index.php 150 151 {{{ 152 153 <!DOCTYPE html> 154 <html> 155 <body> 156 <?php 157 date_default_timezone_set("Asia/Colombo"); 158 echo "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 {{{ 180 docker build . -t <Docker Hub username>/<repository name>:v1 181 }}} 182 183 . 184 185 186 '''Share a Docker image''' 187 188 189 {{{ 190 docker login -u <docker hub username> 191 docker push <docker hub username>/<respository name>:v1 192 docker logout 193 }}} 194 195