Showing posts with label Miscellaneous. Show all posts
Showing posts with label Miscellaneous. Show all posts

Sunday, 27 November 2016

Docker Toolbox on Windows: Mount any host directory (other than Users directory in c drive) as a data volume

This post is for you, if you are looking for mounting a host directory (which is not underneath the "C:\Users" folder) as a data volume in docker container using Docker Toolbox on Windows.

Problem Statement:


As per docker documentation --- "If you are using Docker Machine on Mac or Windows, your Docker Engine daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory. So, you can mount files or directories on OS X using".

This means, you can mount anything underneath "c:\Users" directory of host your Windows machine as a data volume in docker container seamlessly. For example, let's say you want to dump some data from "c:\Users\tirthalp\data" directory to "data" directory within Redis container in docker. Well, below just executing command will enable you to do it.

docker run -v /c/Users/tirthalp/.docker/data:/data --name <container-name> <image-name>


But, what is there is a need of mounting other folders (any folder which is not underneath "c:\Users" directory) of your Windows machine as a data volume in docker container? Well, that's not a piece of cake. For example, if you execute below command, the container would not complain. But actually mounting of folder in D drive as a data volume could not happen and data from your host Windows machine would not be accessible in docker container.

docker run -v /d/x-temp/data:/data --name <container-name> <image-name>


Solution:

I could not locate official docker documentation on this. After giving few tries, finally these steps worked --- add a shared folder to Docker Host VM and mount it as a data volume. Although the given steps are pretty clear, I thought to share screenshots of the same as following.

Step 1: Stop Docker Machine


Step 2: Add Shared Folder in Oracle VirtualBox Manager

Open Oracle VM VirtualBox Manager. Settings -> Shared Folder -> Add Share Folder (i.e. Tirthal-LABs).


Step 3: Permanently mount VirtualBox shared folder as a shared-data volume in Docker machine

Start docker machine.


SSH to docker machine, create directory in docker machine (i.e. /home/docker/tirthal-projects) and mount VirtualBox shared folder name (i.e. Tirthal-LABs) with it. This should enable you to access host Windows machine's data in docker machine @ /home/docker/tirthal-projects.


Try restarting docker machine. Now if you check at /home/docker/tirthal-projects, you would not see mounted host machine's data. For permanent mounting, add following two lines at the end of profile --- sudo vi /mnt/sda1/var/lib/boot2docker/profile

mkdir /home/docker/<directory-name>
sudo mount -t vboxsf -o uid=1000,gid=50 <virtual-box-shared-folder-name> /home/docker/<directory-name>


Try restarting docker machine again. Now if you check at /home/docker/tirthal-projects, you would not see mounted host machine's data.


Step 4: Mount a shared-storage volume as a data volume

Now you should be able to mount even other than "c:\Users" directories of host Windows machine in docker container as a data volume, if you have completed the above steps 1 to 3 successfully. For example, following command would mount "data" folder in container with a shared-storage "/home/docker/tirthal-projects/temp" on docker machine. Here, the "/home/docker/tirthal-projects" is mounted with the host Window machine's folder (i.e. D:\Tirthal-LABs\).

docker run -v /home/docker/tirthal-projects/temp:/data --name <container-name> <image-name>



References:


Saturday, 29 August 2015

Importance of Software Products Interoperability or Compatibility Matrix

Recently I migrated from old to new laptop, which is in majority cases laborious job. After few weeks, I realized I missed to install VMWare vSphere Client software to access ESXi server.

Somehow I could find that I had vSphere client version 5.5 in my previous laptop, and I just installed latest "vSphere client version 5.5 U3". Then when I tried to login, it stuck on "Updating" popup screen which finally failed to do any progress with multiple tries. Well, I could not understand what it tries to do --- The required client support files need to be retrieved from the server "vsphereclient.vmware.com" and installed. Click Run the installer or Save the installer???


I tried to google solution, but could not find anything useful. I tried uninstall and install latest version 6.0, but could not solve it. This way, I wasted my almost 5 hours. Suddenly I realized, I should check version compatibility between ESXi server and vSphere client. So I searched and found this url - http://partnerweb.vmware.com/comp_guide2/sim/interop_matrix.php. Wow, finally I could fix this problem in just few minutes by installing VMWare vSphere client version compatible to ESXi server 5.0 version.


Lesson Learned:

While installing any software products, if we see installation problems or it reacts weirdly, then we should not forget to refer its version compatibility matrix... :-)

Saturday, 22 March 2014

Fresher Software Developer - What to learn/know for better career growth?

"I am a fresher (or trainee) software developer, can you please advise - what should I learn/know for better career growth?" --- Trainee or fresher developers ask me such question many times and also I see similar questions asked in many forums. So I decided to publish my quick thoughts along with below mind mapping diagram.

This post is most relevant to entry level programmer (of Java or other OOP languages). 


(Right click the image - Open in New Window - Zoom it)

My Thoughts

As a matter of fact, just being expert in coding skills would not be sufficient to grow the career in software application development and maintenance. To explain it further, below are generic thoughts, but examples are given with respect to Java platform.

  1. Certainly the most important parameter is to be efficient in the selected programing language and related standards/frameworks/servers/IDEs (e.g. Java, J2EE, Spring, Hibernate, jUnit/TestNG, Tomcat, jBoss, Eclipse...).

  1. Apart from coding, you must have knowledge or awareness of standard practices or techniques for the code review (meet your friends - static code analyzer tools), unit testing (e.g. TDD, BDD), source code versioning (e.g. CVS, SVN, Git), build tool (e.g. Ant, Maven, Gradle), code reverse engineering, code refactoring, etc.

  1. Understand the different phases of software design life cycle (SDLC - requirements, specification, architecture, design, construction…) and related methodologies/processes.

  1. Build strong knowledge in object oriented programming and design. Apply OO fundamentals, Design principles (SOLID, GRASP), Design patterns  and Anti-patterns in coding as applicable.

  1. Know the guidelines of effective API design & used architectural styles and patterns in the project.

Final Summary

When you start the career,

Spend your 80% time --- for building coding expertise in chosen programming language and related standards / frameworks.

In the remaining 20% time on regular basis --- you should explore other software development and design related areas such as -
  • Standard practices or techniques for code review, unit testing, source code versioning, build process, code refactoring, reverse engineering…
  • Software development methodologies / processes
  • OOP concepts, Design principles, Design patterns, Anti-patterns
  • Design effective APIs
  • Architectural styles and patters

As you grow your experience, gradually you should swap above mentioned time spending ratio in reverse way. 

Disclaimer 

I have not mentioned the importance of required soft-skills / non-technical skills as part of this post.