Docker

Docker is an open-source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. Containers simplify the delivery of distributed applications and have become increasingly popular as organizations shift to cloud-native development and hybrid multi-cloud environments.

DockerLogo

Containers are made possible by process isolation and virtualization capabilities built into the Linux kernel. Docker provides wide range of prebuilt containers which can be used in our custom image to make work easy. Installation

~ Arch

yay -S docker-git

~ Debian

sudo apt install docker.io

OR

visit this page, choose your version, browse to pool/stable/ choose your architecture

~ Download .deb file

sudo dpkg -i path/to/installed-file.deb

Error fixing

After Installation if you face some problem like below:

 tcp://localhost:2375/usr/lib/systemd/system/docker.socket.
 Is the docker daemon running?

Then here is the solution :

  1. Add your self to the docker group
usermod -aG docker $USER
  1. Fix permissions on docker socker and command.
sudo chgrp docker /usr/bin/docker
sudo chgrp docker /var/run/docker.sock

Output :

 ~$ ll $(which docker)
    -rwxr-xr-x 1 root docker 18991768 08.07.2017 22:57 /usr/bin/docker*

 ~$ ll /var/run/docker.sock
    srw-rw---- 1 root docker 0 23.07.2017 10:21 /var/run/docker.sock
  1. Add variables to config environment for docker command
export DOCKER_HOST=unix:///var/run/docker.sock
  1. Rest Docker
sudo systemctl restart docker

This should fix the error.

Run

Lets run the hello-world:

 sudo docker run hello-world
  1. Let’s pull our first OS
docker pull centos

You can pull any other os or any available software also from docker hub

  1. run it
docker run -d -t --name <name> centos
  1. check our container is running or not
docker ps
  1. Get into the container
docker exec -it <name> <shell>

Now you will be on your centos.

Thanks for reading.

© Dark-Kernel 2023