Category Archives: Virtualization

podman read logs

sudo podman run --name web1 -dt -p 80:80 docker.io/library/httpd httpd -D FOREGROUND
bf5a2456f8f7e878405097402fe3ed32eb6f9e7b677ac09df1cce841cd7bf527

links -dump http://localhost
It works!

sudo podman container logs -f web1
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.0.33. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.0.33. Set the 'ServerName' directive globally to suppress this message
[Mon Aug 17 20:32:18.221008 2020] [mpm_event:notice] [pid 1:tid 139846430241920] AH00489: Apache/2.4.46 (Unix) configured -- resuming normal operations
[Mon Aug 17 20:32:18.221243 2020] [core:notice] [pid 1:tid 139846430241920] AH00094: Command line: 'httpd -D FOREGROUND'
10.88.0.1 - - [17/Aug/2020:20:32:45 +0000] "GET / HTTP/1.1" 304 -
10.88.0.1 - - [17/Aug/2020:20:32:45 +0000] "GET / HTTP/1.1" 304 -
10.88.0.1 - - [17/Aug/2020:20:32:48 +0000] "GET / HTTP/1.1" 304 -

add container to pod


sudo podman pod create
4d03c9f1ef5f8f944cb61d598084a1191802694e59e7438b36e1dfecdaa04fe3

sudo podman ps -a --pod
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD ID PODNAME
e14f13b36519 k8s.gcr.io/pause:3.2 About a minute ago Created 4d03c9f1ef5f-infra 4d03c9f1ef5f loving_northcutt

sudo podman run -dt --pod loving_northcutt docker.io/library/alpine:latest top

sudo podman ps -a --pod
269ea28c6217 docker.io/library/alpine:latest top 14 seconds ago Up 14 seconds ago strange_hertz 4d03c9f1ef5f loving_northcutt
e14f13b36519 k8s.gcr.io/pause:3.2 3 minutes ago Up 14 seconds ago 4d03c9f1ef5f-infra 4d03c9f1ef5f loving_northcutt

sudo podman pod ps
POD ID NAME STATUS CREATED # OF CONTAINERS INFRA ID
4d03c9f1ef5f loving_northcutt Running 6 minutes ago 2 e14f13b36519

2 containers, it like array for containers

Failed to register the CT: PRL_ERR_VZCTL_OPERATION_FAIL

Failed to register the CT: PRL_ERR_VZCTL_OPERATION_FAILED (Details: Creating OS template cache for centos-8-x86_64 template
Can’t open /proc/sys/kernel/virt_osrelease: No such file or directory
Error: /usr/share/vzyum/bin/yum failed, exitcode=1
VE_PRIVATE is not set
Creation of Container private area failed

Make sure you are using vz7 kernel:
uname -a | grep vz7
Linux CentOS-78-64-minimal 3.10.0-1127.8.2.vz7.151.14 #1 SMP Tue Jun 9 12:58:54 MSK 2020 x86_64 x86_64 x86_64 GNU/Linux

Error processing tar file(exit status 1): there might not be enough IDs available in the namespace (requested 0:42 for /etc/gshadow)

echo user.max_user_namespaces=15076 | sudo tee -a /etc/sysctl.conf
echo 'vit:100000:65536' | sudo tree -a /etc/subuid
echo 'vit:100000:65536' | sudo tee -a /etc/subgid
sudo reboot

sudo podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest 1e4467b07108 2 weeks ago 76.3 MB

converting CentOS 7 to VZ7

centos install virtuozzo
yum install epel-release
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/o/openvz-release-7.0.14-3.vz7.x86_64.rpm
yum localinstall openvz-release-7.0.14-3.vz7.x86_64.rpm python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm

wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/r/readykernel-scan-0.11-1.vl7.noarch.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/z/zstd-1.4.4-1.vl7.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/v/vzlinux-release-7-1.vl7.90.x86_64.rpm

mv /etc/yum.repos.d/CentOS-* /root/

rpm -e --nodeps --justdb json-c
yum erase jansson
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm

yum localinstall jansson-2.10-1.vl7.1.x86_64.rpm
yum localinstall json-c-0.11-13.vl7.1.x86_64.rpm
yum install prlctl prl-disp-service vzkernel *ploop*
yum update

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : Virtuozzo (3.10.0-1127.18.2.el7.x86_64) 7.0.14
1 : Virtuozzo (3.10.0-1127.8.2.vz7.151.14) 7.0.14
2 : Virtuozzo (3.10.0-1127.8.2.el7.x86_64) 7.0.14
3 : Virtuozzo (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7.0.14

grub2-set-default 1
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

#OVZ templates
yum install *ez.noarch

[TOTEM ] knet_handle_new failed: File name too long (36)

corosync fails to start

Aug 01 11:32:30 ubu1 corosync[5546]: [TOTEM ] Initializing transport (Kronosnet).
Aug 01 11:32:30 ubu1 corosync[5546]: [TOTEM ] knet_handle_new failed: File name too long (36)
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] transport: Failed to set socket buffer via force option 33: Operation not permitted
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] transport: Unable to set local socketpair receive buffer: File name too long
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] handle: Unable to initialize internal hostsockpair: File name too long
Aug 01 11:32:30 ubu1 corosync[5546]: [MAIN ] Can’t initialize TOTEM layer
Aug 01 11:32:30 ubu1 corosync[5546]: [MAIN ] Corosync Cluster Engine exiting with status 15 at main.c:1531.
Aug 01 11:32:30 ubu1 systemd[1]: corosync.service: Main process exited, code=exited, status=15/n/a
Aug 01 11:32:30 ubu1 systemd[1]: corosync.service: Failed with result ‘exit-code’.
Aug 01 11:32:30 ubu1 systemd[1]: Failed to start Corosync Cluster Engine.

sudo sysctl -w net.core.wmem_max=8388608
sudo sysctl -w net.core.rmem_max=8388608

sudo systemctl restart corosync.service

install vmware on kvm

sudo virt-install --name esxi70 --ram 4384 --cpu SandyBridge,+pclmuldq,+aes,+xsave,+avx,+vmx --disk path=/var/lib/libvirt/images/vmware.qcow2,size=80,bus=sata --vcpus=4 --os-type linux --os-variant=fedora10 --network bridge=virbr0,model=vmxnet3 --graphics vnc,listen=0.0.0.0 --noautoconsole --video qxl --cdrom /tmp/VMware-VMvisor-Installer-7.0b-16324942.x86_64.iso --features kvm_hidden=on

redirect input into dockerfile


docker build -t myimage:latest  -f- . <<EOF
FROM centos
CMD mkdir /app
WORKDIR /app
RUN echo "file contents" > file.txt
EOF

Sending build context to Docker daemon  16.43kB
Step 1/4 : FROM centos
 ---> 470671670cac
Step 2/4 : CMD mkdir /app
 ---> Using cache
 ---> cf9be82aca00
Step 3/4 : WORKDIR /app
 ---> Using cache
 ---> 24baea1f7712
Step 4/4 : RUN echo "file contents" > file.txt
 ---> Using cache
 ---> 61db761dc411
Successfully built 61db761dc411
Successfully tagged myimage:latest

docker run --name ttt -ti -d --privileged=true myimage  "/sbin/init"
docker exec -it ttt cat '/app/file.txt'
file contents