== Docker Lab == In this lab, you will setup Docker and customize Docker images. '''Requirements:''' 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]] In Virtualbox, 'Extension pack' should be installed. A wired internet connection is preferred. '''VM Setup''' Download VM from the following Link. ​https://docs.learn.ac.lk/index.php/s/YcojJ2544b40Zw4 Import the VM to Virtualbox.[[BR]] Username and Password: '''docker''' [[BR]] May have to create Virtualbox Host-Only Network Adapter[[BR]] {{{ File > Host Network Manager > Create }}} Test internet connectivity.[[BR]] Login using Putty. Login as root to the provided VM. '''Setup Docker''' {{{ apt-get install -y docker.io systemctl enable docker.service }}} '''Managing Docker''' List Docker images {{{ docker image ls }}} Docker image search {{{ docker search }}} Download a Docker image {{{ docker pull }}} List docker containers that are currently running {{{ docker container ls }}} Run a Docker image {{{ docker run -d --name -p 80:80 -d }}} Stop a Docker container {{{ docker stop }}} '''Setup a Docker image''' Create a directory and go inside it. {{{ mkdir cd }}} Make '''Dockerfile''' and insert the following content to it. {{{ FROM php:8.0-apache COPY index.php /var/www/html/ EXPOSE 80 CMD apachectl -D FOREGROUND }}} Make ''' index.php''' and insert the following content to it. {{{ }}} '''Docker Hub Account Setup''' Go to https://hub.docker.com/signup [[BR]] Create an account[[BR]] Choose ‘Personal Plan’ (Continue with free) if asked[[BR]] Create a '''Repository''' '''Build a Docker image''' {{{ docker build . -t /:v1 }}} . '''Share a Docker image''' {{{ docker login -u docker push /:v1 docker logout }}} Now you can view the uploaded Docker image in your Docker Hub account. == LXC Lab == In this lab, you will setup a LXC. '''Requirements:''' Same as the above Docker lab. '''Virtual Machine (VM) Setup''' Download VM from the following Link. ​https://docs.learn.ac.lk/index.php/s/YcojJ2544b40Zw4 Import the VM to Virtualbox.[[BR]] Username and Password: '''docker''' [[BR]] May have to create Virtualbox Host-Only Network Adapter[[BR]] {{{ File > Host Network Manager > Create }}} Test internet connectivity.[[BR]] Login using PuTTY. '''Setup LXC''' Initiate LXC. {{{ sudo lxd init }}} '''Cloning'''