Red Hat Training

A Red Hat training course is available for Red Hat Container Development Kit

Chapter 6. Uninstalling or Reinstalling Container Development Kit

Container Development Kit does not offer any automated uninstallation mechanism. To unistall or reinstall the software, the following steps need to be performed:

  1. Destroy the Container Development Environment virtual machine, and remove its Vagrant box.
  2. Remove the cdk/ directory created by unpacking the Red Hat Container Tools ZIP file.
  3. Only on Linux: remove the Container Development Environment storage image from libvirt.

6.1. Removing Vagrant Boxes

  1. Check for existing Vagrant virtual machines.

    Use the global-status command to display all virtual machines administered by Vagrant for your account:

    $ vagrant global-status
    id       name    provider state   directory
    -----------------------------------------------------------------------
    e781364  default libvirt running /home/test/cdk/components/rhel/rhel-ose
    
    The above shows information about all known Vagrant environments
    on this machine. This data is cached and may not be completely
    up-to-date. To interact with any of the machines, you can go to
    that directory and run Vagrant, or you can use the ID directly
    with Vagrant commands from any directory. For example:
    "vagrant destroy 1a2b3c4d"
  2. Destroy existing Container Development Environment virtual machines.

    Destroy the virtual machine identified in the previous step. Specify the -f or --force option to destroy the machine without an interactive confirmation:

    $ vagrant destroy -f e781364
  3. List installed Vagrant boxes:

    $ vagrant box list
    cdkv2 (virtualbox, 0)
  4. Remove the Container Development Environment Vagrant box.

    Important

    Before you proceed with uninstallation, make sure to back up any work you did within the Container Development Environment. This may include, for example, pushing the container images you prepared to a remote registry, copying files to the home directory that is synchronized to your host system, or exporting OpenShift projects.

    Remove the Container Development Environment Vagrant box (named cdkv2 by default):

    $ vagrant box remove cdkv2
    Removing box 'cdkv2' (v0) with provider 'libvirt'...
    Vagrant-libvirt plugin removed box only from you LOCAL ~/.vagrant/boxes directory
    From libvirt storage pool you have to delete image manually (virsh, virt-manager or by any other tool)
Note

With Red Hat Container Development Kit 2.2, the vagrant box remove cdkv2 command fails to remove Hyper-V Vagrant boxes. To work around this issue when you wish to use a different Hyper-V box, you need to forcefully overwrite the existing box:

$ vagrant box add cdkv2 new-hyper-v-box.img

6.2. Removing Red Hat Container Tools

Red Hat Container Tools, which is the contents of the cdk-2.2.0.zip file, can be removed by deleting the cdk/ directory, including its subdirectories.

Note

When reinstalling the Container Development Environment without updating Red Hat Container Tools, skip this step and only install a different Vagrant box.

  1. Remove the Red Hat Container Tools ZIP file (cdk-2.2.0.zip) and the cdk/ directory. This example assumes that the Red Hat Container Tools ZIP file was downloaded to the Downloads/ directory and unpacked directly to the home directory:

    • Run the following commands on Linux or Mac OS X:

      $ rm -rf ~/cdk/
      $ rm ~/Downloads/cdk-2.2.0.zip
    • On Microsoft Windows, run the following commands:

      $ rmdir %USERPROFILE%\cdk\ /s /q
      $ del %USERPROFILE%\Downloads\cdk-2.2.0.zip
  2. Uninstall the Vagrant plugins supplied with Container Development Kit:

    $ vagrant plugin uninstall vagrant-registration vagrant-service-manager vagrant-sshfs
    Uninstalling the 'vagrant-registration' plugin...
    Uninstalling the 'vagrant-service-manager' plugin...
    Uninstalling the 'vagrant-sshfs' plugin...

6.3. Deleting libvirt Storage Images

On Linux, when the libvirt hypervisor is used, it is necessary to manually delete the storage image that was created for the Container Development Environment virtual machine.

In the following procedure, the rhel-ose_default.img file name is used. Substitute this file name with the libvirt image file name used on your system in all steps of this procedure.

  1. List all storage images to identify the one you need to delete:

    # virsh vol-list default
     Name                 Path
    ----------------------------------------------------------------------
     rhel-ose_default.img /var/lib/libvirt/images/rhel-ose_default.img
  2. Change the ownership of the image file:

    # chown root:root /var/lib/libvirt/images/rhel-ose_default.img
  3. Output volume information:

    # virsh vol-dumpxml rhel-ose_default.img --pool default
  4. Delete the image:

    This can be done in two alternative ways. Use the second one if the first one does not work.

    • Use the vol-delete command with virsh:

      # virsh vol-delete rhel-ose_default.img --pool default
    • Alternatively, delete the file directly and refresh the volume pool:

      # rm /var/lib/libvirt/images/rhel-ose_default.img
      # virsh pool-refresh default
  5. Restartd the libvirtd daemon:

    # systemctl restart libvirtd

6.4. Reinstalling Container Development Kit

After completing the uninstallation of Container Development Kit, start a new installation by unpacking the Red Hat Container Tools ZIP file and adding a new Container Development Environment Vagrant box as described in:

6.5. Additional Resources