Category Archives: Technology

Fixing Random Samba Share Lockouts w/Docker

Continuation of my previous post about fixing random Samba Share lockouts. I discovered that Docker and Samba were fighting to gain access to the folders. If I set the label to samba_share_t, then Docker loses access. If I allow Docker (with “Z” option while running container), then Docker resets the label to “svirt_sandbox_file_t”. How can I make both use it? Turns out there is a solution. Credit to this Serverfault post:

Create a new SELinux Policy Module to allow Samba to access the Docker label.

Then start the Docker container with Volumes mounted using “Z” option. You should now be good to go with both Samba and Docker living together happily ever after…


Jasmine my print server

Last week I built a print server at home. I already have a home server called Jarvis which does media sharing through Plex and runs this blog but it’s situated in the basement. The printer I wanted to use is a USB label printer therefore it wasn’t feasible for me to use Jarvis as a print server as it would have required a very long USB cable from basement to second floor where my home office is. So I decided to build a new server which I could keep in the home office. I knew that this server does not need to be a very high end server with respect to configuration since all it will do is printer sharing. Therefore, I decided to build it using low end components. I already had a spare computer case, a stick of 4GB Laptop DDR3L RAM, a spare 120GB SSD and a mini PCIe Wireless card pulled from a laptop I used to own. All I needed was a PSU, motherboard (that could take laptop RAM and mini PCIe card), CPU and antenna for Wireless card. My total budget was around $80; comparable wifi printers were running over $100.

I began my search for a motherboard and CPU by looking for an embedded solution, i.e., a motherboard that comes with an onboard CPU. I had heard of AMD AM1 motherboards with onboard Kabini CPUs and also of Intel boards with Celeron. I was also interested to see if I can buy a board that had onboard DC jack. That would eliminate using an internal PSU. However, I eventually decided against a motherboard with onboard DC jack as those motherboards were expensive and they still required external AC Adapter which were running around $20. Searching on I finally found a suitable motherboard called ECS BAT-I, a mini-ITX board with onboard J1800 Intel Celeron processor; small and powerful enough that has a slot for laptop RAM and a mini PCIe slot for wireless card. Cost $40.

Photo courtesy

For PSU, I decided to buy Corsair CX430 PSU from for $40 but had a $20 Mail-in-rebate. I had used CX430 before and I knew it’s an excellent PSU for the price. Although, a bit too much power for the CPU and Motherboard but nevertheless I thought it’s the best value for money. Cost $20 (with Mail-in-rebate).

Photo courtesy

Finally, I needed antenna for the mini PCIe Wireless Card. I found one on for $10 which seemed to have good reviews.

Photo courtesy

With all the components in my possession, I assembled the computer. Then I installed CentOS 7 on it as the operating system. I chose CentOS because I was already using the same for Jarvis and it’s a fantastic OS for a server. I finally named my new server “Jasmine”.

The overall cost for Jasmine came out to be $50 which I spent only for CPU/Motherboard, PSU and wireless antenna. Of course, I was lucky to have the other essential components such as a Case, SSD, RAM and Wireless card already handy. However, if I didn’t, it would have been a challenge to contain the cost to $80. More than likely then I would have chosen Raspberry Pi.

Links to components

Interested to know how I configured CentOS for print server and Windows to use network printer? Check my post here

How to configure Brother QL-700 label printer on CentOS

I recently built a print server at home where I have attached the Brother QL-700 label printer. That printer does not have Wireless printing feature and I wanted to have all computers in the house be able to use it over the network. I thought of buying a new label printer that comes with Wireless connectivity but I couldn’t find any brand new label printer less than $100. Then I had an idea. Why don’t I build a print server? So using a few spare computer components and purchasing a few new components, I built a print server. But that’s not what I want to discuss in this post… (maybe a dedicated post for that – finally one here). What I really want to discuss is how I configured my printer to work on CentOS and be able to print through Windows.


  • You have the printer plugged into the CentOS computer using USB port
  • The computer has CentOS 7 (might work for earlier versions as well)
  • The computer has network connectivity (either Wireless or Wired)
  • “CUPS” is installed and accessible via http://<server host>:631
  • Samba is installed and running on the Server

Step 1: Download and install the printer driver

Brother’s website actually has printer drivers available for CentOS. 

  • After installation is successful, install the printer driver in the order below

  • After installation is successful, set the Default Options for the printer in the CUPS portal
  • Go to the CUPS portal, then Printers tab
  • Select the QL-700 printer, then in the “Administration” drop down, select “Set Default Options”
  • In the “Basic” Options, set Media Size to the most appropriate paper size in the printer. For me it was “62mm(2.4″)”

Step 2: Configure SELinux

SELinux will deny you access to printer. This is where I spent many hours trying to figure out why my printer wasn’t printing anything. To remedy this, do one of the following:

  1. Permanently disable SELinux (Not recommended)
  2. Temporarily disable SELinux (It gets enabled next time server reboots – so not really very useful)
  3. Configure it to permanently allow Printer access (Recommended)

I chose Option 3. Here’s how to configure SELinux to allow Printer access:

  • Temporarily disable SELinux

  • Then print a test page. This will be in CUPS portal -> Printers. Under “Maintenance” drop down, “Print Test Page” Option
  • Hopefully, a test page will be printed
  • Then log on to the Server to find out what SELinux policies to set

  • This should print something like below

  • You need to then create an SELinux module out of above by running the following command

“cupspolicy” name is representative. You can give any name as long as it is unique for SELinux

  • After this, make the policy package active by running following command:

  • Now either reboot the server or remove the SELinux permissive mode

You should now be able to print another test page. At this point you are all set for configuring Samba.

Step 3: Configure Samba

I use Webmin to manage the server. This allows me to use a GUI interface to perform Samba configuration. If you know your way around commands you can do the same through Console as well.

  • In Webmin, go to Servers -> Samba Windows File Sharing
  • Select “printers”, then set various options as follows

  • Save and then go to “Security and Access Control”. Then give “Guest” access (or any other level of access as you need)

  • At this point you should be all set from Server side

Step 4: Configure Windows computer

  • Go again to Brother’s website and this time download drivers and software for Windows 10 64 bit (or other Windows):
  • Install the driver and software
  • After that, Add the network printer by going to: Control Panel\Hardware and Sound\Devices and Printers
  • In the “Add a device” wizard, select “The printer that I want isn’t listed”
  • In the next screen, select “Select a shared printer by name” and then in the input box, type the http address for the CUPS site for the printer. It should be something like “http://<serverhost>:631/printers/QL-700”
  • When I asked for Driver, select “Brother” as manufacturer and “Brother QL-700” as printer

  • Hit OK and complete the set up
  • After that the QL-700 printer should show up under “Printers”
  • Next, you need to create a Custom Layout in “P-touch Editor”. This step was required for me because I wanted to print small address labels but the printer was erroring out not recognizing the layout (Hint: red flashing light)
  • In the “P-touch Editor”, open the “Small Address Label” (2.4″ x 1.1″) layout, and then set the Length from 1.1″ to “Auto”

  • Save the layout as “Custom_Small_Address” or any other name (File -> Save As)
  • Then import the layout in “P-touch Address Book” software. This is the software I use most frequently to print address labels (Layout -> Import Layout). The custom layout should appear under “My Templates”
  • At this point, you are all set. Try printing the label using the custom layout and hopefully it will print


Let me know if you are facing issues. It took me several hours to find out what was wrong but finally I was able to configure the printer. It may be same for you. I can try to help you if I could. Most of the issues were related to driver install, SELinux and media size, so be sure to follow each and every step above.

Configuring GD and Freetype on WordPress Docker Image

This applies to official WordPress image but can be used with PHP image also.

Create Dockerfile with following contents:

Build your image

Or you can use my image here.


Using WordPress and MySQL Docker Containers

I am just starting out on Docker and so far it’s been fun. Here I am going to show how I used Docker WordPress and MySQL containers.

Before I delve into the details, I want to tell you that I am going to be working on Windows using SSH on Docker VM. If you want to know how to do that see this post here.

So let’s start. Open SSH console. We are going to set up MySQL first.

On your landing directory, create a folder for MySQL. I am going to call it “mysql”

Change directory to the newly created folder

We are going to use official Docker MySQL image located here. Version: 5.7

Here’s the run command I am going to use. This will map port 3306 on the container to the VM thereby allowing me to access this MySQL instance using VM’s IP address and port 3306

But for ease of use I like to put the run command inside a Shell script I name as “”.

Create “” with following contents.

Make the script executable

Then, run the script.

Of course, I had already done this before therefore you see “Already exists” messages. If you are doing this for the first time, image should get downloaded which could take 2-3 minutes depending on your internet connection.

Now I can test this MySQL instance using any Windows DB Client. Use following settings with obviously the password you set. Note, I am using “root” as login. This is only for demonstration. Obviously, you will disable it in production.


Once configured, you should be able to connect to the MySQL instance.


So far so good, let’s set up WordPress now.

Like MySQL, we are going to use official WordPress image from here.

But first, let’s create folder for wordpress. I am going to call it, simply “wordpress”

Change directory…


Here, we are linking previously created MyMySQL container with this going to beĀ  created MyWordpress container. Also, we are going to map port 80 of the container to port 80 of the VM.

Execute script

Fire up a browser on your Windows machine and go to “” and you should see WordPress Installation page!


Configuring Docker SSH on Bitvise on Windows

Docker on Windows has a lot to be desired. One thing I found uncomfortable to use is the Docker Shell on Windows. As of version 1.11.2, Docker uses MINGW64 extension to provide the UNIX Shell on Windows and even then it operates on the host, i.e. the Windows machine. If you know the current architecture, Docker runs on a Linux VM on top of Windows host. Therefore, what gets typed on Docker console is eventually passed to the VM. Through wonderful Docker documentation I figured I could actually SSH directly into the VM itself, and it’s very easy.

Docker Console on Windows
Docker Console on Windows

For my SSH I use Bitvise SSH client but these steps should apply to any other client such as Putty. Docker provides SSH private key which could be used by any client.

Open Bitvise Client Key Manager, and click on “Import”. Then Navigate to “c:\users\userid\.docker\machine\machines\default” and select “id_rsa” file. Import the file and note down the Location. It should be “Global n” where n=1,2,3 etc.


Next open Bitvise SSH Client. Configure a profile with following details:


Hit login and hopefully you will be logged in!


PyCharm on Windows and Docker

I have recently started using Python and Docker. As a novice, I wanted to configure PyCharm on Windows to use my Docker Python image. Here are couple of things I had to do to successfully accomplish this:

  • Your Project folder must be inside your Windows home folder, i.e. c:\users\user. If not, PyCharm will not be able to run your Python file

2016-06-16 21_02_45-Location

  • Next, ensure that Docker is selected as a “Remote Python Interpreter”. Obviously as a prerequisite you must install Docker and pull Python image. If done correctly, PyCharm should recognize the interpreter

2016-06-16 21_01_10-ConfigureDocker

With this you should be able to run your Python code directly against Docker image. Here’s a Hello World example I ran.

2016-06-16 21_04_28-HelloWorld - [C__Users_vikc0_Python_HelloWorld] - - PyCharm 5