Tuesday, November 19, 2019

Create a Docker image by modifying existing images

There are two ways to create a new Docker image, and they are shown below:
- Create images by modifying existing images
- Create images by utilizing Dockerfiles

This document is to demonstrate how to create images by modifying existing images (P.S.: The following example shows how to modify an existing image named httpd and save it as a new image named demonalex/httpd:2)
#systemctl start docker
#docker run -it httpd /bin/bash
After modifying the image, execute the following commands:
#docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
884fa8ecd4bd        httpd               "/bin/bash"         8 minutes ago       Up 8 minutes        80/tcp   hardcore_aryabhata
#docker commit 884fa8ecd4bd demonalex/httpd:2
#docker images|grep httpd
demonalex/httpd                   2                   a6a8c482adec        41 seconds ago      205MB
httpd                             latest              19459a872194        2 months ago        154MB
#docker run -it demonalex/httpd:2 /bin/bash

Sunday, November 17, 2019

Docker File Import and Export

Export Image:
#docker save [OPTIONS] IMAGE [IMAGE...]
Example:
#docker save busybox > busybox.tar


Import Image:
#docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Example:
#docker import /path/to/exampleimage.tgz


Load Image from Files:
#docker load [OPTIONS]
Example:
#docker load < busybox.tar.gz

Installing KVM at Kali Linux

#apt-get update
#apt install -y qemu-kvm libvirt0 virt-manager libguestfs-tools bridge-utils
#mkdir -p /var/lib/libvirt/iso
#cp ~/Downloads/*.iso /var/lib/libvirt/iso
#virt-manager