Allowing user on CentOS to run docker command without sudo

Out of the box for a Docker install on CentOS 7, you have to sudo the docker command to interact with Docker. Per the post-install steps here, create a docker group and add your user to that group:

sudo groupadd docker

sudo usermod -aG docker youruser

Logging off and back on again, you should now be able to run the docker command without sudo.

On CentOS 7 this still didn’t work for me. Following this post, it appeared that docker.sock was owned by root and in the group root:

$ ls -l /var/run/docker.sock

srw-rw---- 1 root root 0 Oct 21 15:42 /var/run/docker.sock

Changing the group ownership:

$ sudo chown root:docker /var/run/docker.sock

$ ls -l /var/run/docker.sock

srw-rw---- 1 root docker 0 Oct 21 15:42 /var/run/docker.sock

After logging back on, now can run docker commands without sudo.

Installing Java 7 JDK on CentOS 7

Openjdk packages on CentOS 7 come in a JRE and a JDK (as you’d expect). If you install java-1.7.0-openjdk you get just the JRE:

$ sudo yum install java-1.7.0-openjdk

$ java -version

java version "1.7.0_151"

OpenJDK Runtime Environment (rhel-2.6.11.1.el7_4-x86_64 u151-b00)

OpenJDK 64-Bit Server VM (build 24.151-b00, mixed mode)

Starting up WLS 10.3.6:

wlserver_10.3]$ cd server/

$ cd bin

$ . ./setWLSEnv.sh

The JDK wasn’t found in directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64.

Please edit the startWebLogic.sh script so that the JAVA_HOME

variable points to the location of your JDK.

$ cd /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64

$ ls

ASSEMBLY_EXCEPTION  jre  jre-abrt  LICENSE  THIRD_PARTY_README

Only a JRE there, no JDK.

From here, install the devel package too:

sudo yum install java-1.7.0-openjdk-devel

Now we look good:

$ . ./setWLSEnv.sh

CLASSPATH=/home/kev/Oracle/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/kev/Oracle/Middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64/lib/tools.jar:/home/kev/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/kev/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/kev/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/home/kev/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/kev/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/kev/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:

PATH=/home/kev/Oracle/Middleware/wlserver_10.3/server/bin:/home/kev/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64/jre/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64/bin:/home/kev/Oracle/Middleware/wlserver_10.3/server/bin:/home/kev/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64/jre/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151-2.6.11.1.el7_4.x86_64/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/kev/.local/bin:/home/kev/bin

Your environment has been set.

Good to go!

Cloning an existing VM on VMware ESXi using command line vmkfstools

Apparently vCenter Server provides the ability to clone VMs via the Client, but not if you’re just using ESXi and managing your host directly with the web client. It is possible however to clone a VM’s disk using the vmkfstools commanline utility as described in this post.

Here’s a summary of the steps:

Enable SSH from the ESXi web console: Host / Manage / Services

In my case I wanted to create a copy of an existing CentOS7 VM. SSH into your ESXi host, then:

vmkfstools -i CentOS7-1/CentOS7-1_0.vmdk CentOS7-2/CentOS7-2.vmdk -d thin

Next, create a new VM as normal, but on the Customize Settings dialog, press the X on the right to delete the disk created by the new VM wizard:

Next, press ‘Add new disk’, select ‘Existing hard disk’, then point to the copy of the VM disk that you created with the vmkfstools command:

Credit to this post for the tip to configure using an existing disk.