Docker Build

docker build command is used to create a docker image from Dockerfile.

To create an image, first lets create a working directory and change to the directory.

Create a file with name Dockerfile

Put following content in it

Now build the docker image with

This will create a docker image with name “my-ubuntu”.

To run this, we need to create a container using this image, this can be done with command

Here i used -ti as we need to run interactively using terminal, this is because our the command we set to start is “/bin/bash” in the Dockerfile.

Docker

Mount Windows Share in Linux

On Ubuntu, install cifs-utils

First create a directory on which we can mount the windows share

Now create a file to store windows share username and password.

Add following to the file

Now run

192.168.0.4 – Replace with IP of your Windows computer with share.

LINUX_USER_NAME – Replace with the Linux user name you want the files to be owned.

To make share mounted on boot, edit

Add

mount

Fatal error: Can’t open and lock privilege tables

On a Cpanel Server, MySQL did not start. I checked the error log in /var/lib/mysql folder, found following error

2018-05-02 12:08:34 30796 [ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘./mysql/db’ is marked as crashed and should be repaired

It says “db” table in “mysql” database got corrupted. To fix, i run following

Now restart MySQL with command

Debian 9 OVH Bridge Network Configuration

When you run VPS on OVH network behind bridge network, you need to create VMAC for each IP and assign to your network card.

Once this is done, you need to use following network configuration in your /etc/network/inferfaces file.

Here is an example config file i use in one of my VPS

I made a pull request to OVH as OVH documentation use route command, that is deprecated in Debian 9 and Ubuntu 18.04. We need to use “ip route” command instead of “route” command.

Disable bitnami banner from wordpress

To remove logo from bitnami wordpress, login to SSH as user “bitnami”, then run

Now restart web server

If you are using Nginx, run

WordPress bitnami

Resize gcow2 image with qemu

To resize gcow2 image, run

To create a gcow2 image, run

You can also use

virt-resize is part of http://libguestfs.org

500 I won’t open a connection to x.x.x.x (only to y.y.y.y)

When connecting to FTP server from a remote server hosted in Microsoft Azure i get error

500 I won’t open a connection to x.x.x.x (only to y.y.y.y)

This is because you are behind NAT firewall and trying to use FTP in Active mode.

To fix the error, enable FTP passive mode with command

ftp

tar

List content of a tar file

If you want to exclude a folder from the file list, use

This will exclude all files that are inside folder “home/haridy/Maildir”. You can use multiple –exclude if required.