Skip to main content

Posts

Showing posts with the label Docker

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Root cause of this error message is only that DOCKER_HOST variable has not been exported to all the users. In my case it was working fine while I was running docker commands as root user but when I tried the same commands from Jenkins, didn't work. To understand this issue in detail let me create such environment and see troubleshooting steps. Docker Host - [root@server106 ~]# hostname server106.example.com Docker Client - [root@server109 ~]# hostname server109.example.com [root@server109 ~]# docker ps -a CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES [root@server109 ~]# docker ...

docker: Error response from daemon: OCI runtime create create failed

docker: Error response from daemon:  OCI runtime create create failed: container_linux.go:348: starting container process caused "exec: \"/usr/sbin/init\": stat /usr/sbin/init: no such file or directory": unknown. If you are getting above error message trying to launch a container. Simple fix of this error message is to set SELinux in permissive mode. [root@server109 docker-ws]# setenforce 0

Docker project

Since last few weekend I am learning Docker. A great initiative from Linux word under IIEC Rise and guidance of Vimal Daga. At the completion of this training I have implemented container technology and created my own monitoring system(Moatis). Project steps:- Pull centos:7 image I created a volume for persistent storage  Launched a container Exposed it to public Login into newly created centos container Deployed Nagios Setup monitoring on few hosts Tested if each and everything is working fine or not. Please check below for all the commands which I have executed to complete this project. Commands I have executed on Container Host -    176  podman container ls   177  podman container ls -a   178  podman image ls   179  podman volume create mymoatis   180  podman volume inspect mymoatis   181  cd /var/lib/containers/storage/mymoatis/_data/   182  ls   183  pod...

Failed to get D-Bus connection: Operation not permitted

" Failed to get D-Bus connection: Operation not permitted " - systemctl command is not working in Docker container. If systemctl command is not working in your container and giving subjected error message then simple solution of this error is, create container with -- privileged option and also provide init file full path  /usr/sbin/init [root@server109 ~]# docker container run -dit --privileged --name systemctl_not_working_centos1 centos:7 /usr/sbin/init For detailed explanation and understanding I am writing more about it, please have look below. If we have a daemon based program(httpd, sshd, jenkins, docker etc.) running inside a container and we would like to start/stop or check status of daemon inside docker then it becomes difficult for us to perform such operations , because by default systemctl and service  commands don't work inside docker. Normally we run below commands to check services status in Linux systems. [root@server109 ~]# systemctl status ...

Dockerfile, Create your own container image

Dockerfle is a very important concept to create you own container image. However there are lots of images available on docker hub but these are standard images and creators of these images are not aware about our requirement and environment. In this situation we need our own images. There are two way to create your own container images. docker commit - We can create our own images using 'docker commit' command but only limited feature available in this approach. In below command centos  is my existing container name and webserver:v1 is my new image name and version. [root@server109 docker-ws]# docker pull centos [root@server109 docker-ws]# docker container commit centos webserver:v1 docker build - A powerful approach to create a container image, We can customize our image as more as customization required. This approach is also known as Dockerfile approach. As of now I have below images available in my environment but I need an image which has  net-...

DevOps : Integration of Git, GitHub, Jenkins, Docker and Linux

  If you have knowledge of a subject, it is always great but if know how and where you can utilize it became your talent. Likewise if you have knowledge of some technologies and also know how to use them. In other words I would like to say, you know how to integrate these technologies? Just by doing this you can create your own product, you can become a creator. I have lots of examples of it, but one of them is OpenStack (Collection of lots of services like Glance, shift, cinder, nova, neutron, Gnocchi etc).   I am also writing this post to show you an interesting demo. In which I'll integrate multiple tools like Git, GitHub, Jenkins, Docker, Linux etc. and I will try to solve a use case. We have a web app developed by multiple developers will be first of all deploy in test environment, Then it will be checked by UAT team and if everything is fine and approved all the requirement from QAT team then automatically deployed in production environment. So lets start with...

OpenShift Basics and high level architecture

Minimum requirement to run any program/software/application we need an environment and this kind of environment is known as operating system(OS). As I explained in last post there are total 4 techniques we have for OS provisioning , and containerization is the fastest approach. Just within few seconds we can not only launch a full flash OS but all we can access an application as well. There are lots of container tools are available like Docker, Podman, CRI-O but these are depended on runc . RUNC is lowest level which directly run on top of kernel. Just to understand in simple language we can say tha runc is a server for container tools and container tools(Docker, Podman, CRI-O) are just client of it. There are two type of docker tools we have - Daemon based and Daemon less, docker is daemon based and Podman and CRI-O are daemon less. That means in - Docker - Talk with docker.service and this services talks with runc. Podman/CRI-O - Directly talk with runc That is the tech...

OpenShift introduction and basic terminology

I am starting learning few more things from today onwards. Which are one of the most demanded technology now a days & terminology namely - Container | Docker | Podman | OpenShift . Red Hat official training under guidance of Mr. Vimal Daga . Today's learning :- There are 4 ways of OS(Operating System) provisioning we have - 1. Bare-Metal (Install OS directly on physical hardware), 2. Virtualization (VM), 3. Cloud (Instance), 4. Containerization (container). Here I'll focus on Containerization technology, containers & container orchestration. Containerization is the fastest way of OS provisioning, we can launch a full flash and ready to use OS just within few seconds. Which is known as Container. The host on which we install Docker/Podman is known as Docker/Podman host . The role of Docker is just to launch an OS. Docker is doing great whatever it was created for, but still there was few things those needs to be upgraded, and then a tool named Podman came in m...

Docker - How to create your own Blog/WebApp/Web site?

Let's convert  lockdown  days into  Learning days  and today's learning is :- 1. Started with what is Wordpress , what is it and how it work? 2. Created a architecture of how I can create my own blog? For this I need WordPress and MySQL two docker images so lets pull them from docker hub and start with implementation. [root@server109 ~]# docker pull wordpress:5.1.1-php7.3-apache [root@server109 ~]# docker pull mysql:5.7 3. Created two storage in docker one for mysql and another is for WordPress container [root@server109 ~]# docker volume create mywp-storage mywp-storage [root@server109 ~]# docker volume create mysql-storage mysql-storage 4. Launch a MySQL container with environment variable (-e option) database, username, customized storage(created previously [root@server109 ~]# docker container run -dit -e MYSQL_ROOT_PASSWORD=redhat -e MYSQL_USER=rakesh -e MYSQL_PASSWORD=redhat -e MYSQL_DATABASE=mydb  -v mysql-storage:/var/lib/mysql --name...

Configure local yum on docker container

Configure local yum on docker container. Below are the simple steps to configure local yum using RHEL8 iso in docker container- Step 1 - Mount your ISO on your (Docker)local system [root@server109 ~]# mkdir /iso [root@server109 ~]# mount -o loop /RHEL-8-0-0-BaseOS-x86_64.iso /iso [root@server109 ~]# Step 2 - Launch a container [root@server109 _data]# docker container run -dit --name yum -v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso  centos:7 a3483d2b718f339f6c3e9a4600e27e61086af512ef6bca67fcc1b73ada70838c -dit - Tags(Detach, Interactive, Terminal ) --name yum - Name of container -v /run/media/root/RHEL-8-0-0-BaseOS-x86_64/:/iso - /iso here dvd will bind on container centos:7 - Name of container image:version Step 3 - Attach container [root@server109 _data]# docker container attach yum [root@a3483d2b718f /]# cd /iso/ [root@a3483d2b718f iso]# ls AppStream  BaseOS  EFI  EULA  GPL  RPM-GPG-KEY-redhat-beta  RPM-GPG-KEY-redhat-rel...