The container technology is great, and it will change the way we develop the delivery software. Of course, some people who criticize this technology think it is not safe and safe enough to run in the product environment. With the login of RedHatEnterpriseLinux7.1 and RedHatAtomic, enterprises and organizations can embrace this new technology trend without sacrificing security and performance. What RedHatCDK? CDK is ContainerDevelopmentKit (Container development
The container technology is great, and it will change the way we develop the delivery software. Of course, some people who criticize this technology think it is not safe and safe enough to run in the product environment.
With the login of Red Hat Enterprise Linux 7.1 and Red Hat Atomic, enterprises and organizations can embrace this new technology trend without sacrificing security and performance.
What Red Hat CDK?
CDK is the abbreviation of Container Development Kit (Container Development Kit). It allows developers to use Red Hat Atomic on their desktop systems, regardless of Microsoft Windows®, Mac OS X®Or other Linux releases. Similar to boot2docker, CDK uses a virtual machine to start a small host that can run containers based on Red Hat Enterprise Linux.
Prerequisites
Red Hat subscription-to install Red Hat CDK, you have to have an activated Red Hat Enterprise Linux subscription. If not, apply for and view it here.
Virtual Environment-VirtualBox (Mac/Windows) or virt-manager (Linux)
Vagrant-create and manage virtual environments.
Download the following items from the Red Hat consumer portal.
Red Hat Container Tools)
Red Hat Atomic Vagrant box for VirtualBox or Red Hat Atomic Vagrant box for libvirt.
Install Red Hat container Development Kit
Note: before that, you need to install the virtualization environment and Vagrant.
Decompress the downloaded cdk.zip file to the main directory. This will create ~ /Cdk (/Users/username/cdk)
$ Unzip-d $ HOME ~ /Downloads/cdk-1.0-0.zip
Install the Vagrant plug-in required by Red Hat Vagrant. The first plug-in takes several minutes. Vagrant may need to install some additional gem files.
$ Cd ~ /Cdk/plugins
$ Vagrant plugin install vagrant-registration-0.0.8.gem
$ Vagrant plugin install vagrant-atomic-0.0.3.gem
Verify that the plug-in has been installed:
$ Vagrant plugin list
Vagrant-atomic (0.0.3)
-Version Constraint: 0.0.3
Vagrant-registration (0.0.8)
-Version Constraint: 0.0.8
Add the RHEL Atomic box to Vagrant:
$ Vagrant box add -- name rhel-atomic-7 ~ /Downloads/rhel-atomic-virtualbox-7.1-0.x86_64.box
Start Atomic host
Create a working directory for the docker File
$ Mkdir ~ /Containers & cd ~ /Containers
Create a working directory for the container and initialize vagrant
$ Mkdir containers & cd containers
$ Vagrant init-m
A 'vagrantfile' has been placed in this directory. You are now
Ready to 'vagrant up' your first virtual environment! Please read
The comments in the Vagrantfile as well as documentation on
'Vagrantup. com' for more information on using Vagrant.
This step creates a simple Vagrant file. Open it and modify the configuration as follows:
Vagrant. configure (2) do | config |
Config. vm. box = "rhel-atomic-7"
Config. vm. hostname = "rhel-atomic-7-docker-host"
Config. vm. provider "virtualbox" do | vb |
Vb. customize ["modifyvm",: id, "-- cpuexecutioncap", "50"]
Vb. memory = 4096
End
Config. vm. provision "shell", inline: <-SHELL
Sudo systemctl stop docker>/dev/null 2> & 1
Sudo groupadd docker>/dev/null 2> & 1
Sudo usermod-a-G docker vagrant
Sudo systemctl enable docker & sudo systemctl start docker
Sudo chown root: docker/var/run/docker. sock
Sudo systemctl enable docker & sudo systemctl start docker
SHELL
End
Now we are ready to start the container. During the creation of the machine, you will see a prompt about whether you want to register the system. To answer "Y", you will be asked to enter the user name and password of the RHN (Red Hat Network) account.
$ Vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> Default: Importing base box 'rhel-atomic-7 '...
==> Default: Matching MAC address for NAT networking...
==> Default: Setting the name of the VM: containers_default_1432213616739_95846
==> Default: Clearing any previously set network interfaces...
==> Default: Preparing network interfaces based on configuration...
Default: Adapter 1: nat
==> Default: Forwarding ports...
Default: 22 = & gt; 2222 (adapter 1)
==> Default: Running 'pre-boot' VM mizmizations...
==> Default: Booting VM...
==> Default: Waiting for machine to boot. This may take a few minutes...
Default: SSH address: 127.0.0.1: 2222
Default: SSH username: vagrant
Default: SSH auth method: private key
Default: Warning: Connection timeout. Retrying...
Default:
Default: Vagrant insecure key detected. Vagrant will automatically replace
Default: this with a newly generated keypair for better security.
Default:
Default: Inserting generated public key within guest...
Default: Removing insecure key from the guest if its present...
Default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> Default: Machine booted and ready!
==> Default: Checking for guest additions in VM...
Default: No guest additions were detected on the base box for this VM! Guest
Default: additions are required for forwarded ports, shared folders, host only
Default: networking, and more. If SSH fails on this machine, please install
Default: the guest additions and repackage the box to continue.
Default:
Default: This is not an error message; everything may continue to work properly,
Default: in which case you may ignore this message.
==> Default: Setting hostname...
==> Default: Registering box with vagrant-registration...
Default: wocould you like to register the system now (default: yes )? [Y | n] y
Default: Subscriber username:
Default: Subscriber password: ==> Default: Rsyncing folder:/Users/tqvarnst/containers/==>/home/vagrant/sync
==> Default: Running provisioner: shell...
Default: Running: inline script
Test your installation
$ Vagrant ssh
[Vagrant @ rhel-atomic-7-docker-host ~] $ Docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[Vagrant @ rhel-atomic-7-docker-host ~] $ Docker run-it rhel7.1 bash
Unable to find image 'rhel7. 1: latest 'locally
Pulling repository registry.access.RedHat.com/rhel7.1
10acc31def5d: Download complete
Status: Downloaded newer image for registry.access.redhat.com/rhel7.:latest
[Root @ ead3774c2b84/] # cat/etc/redhat-release
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[Root @ ead3774c2b84/] #
Press the CTRL-P + CTRL-Q to leave your container
[Vagrant @ rhel-atomic-7-docker-host ~] $ Docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Ead3774c2b84 registry.access.redhat.com/rhel7.:7.1-4 "bash" About a minute ago Up About a minute focused_rosalind
Run the following command to stop or delete a container:
[Vagrant @ rhel-atomic-7-docker-host ~] $ Docker stop $ (docker ps-q)
Ead3774c2b84
[Vagrant @ rhel-atomic-7-docker-host ~] $ Docker rm $ (docker ps-aq)
Ead3774c2b84
Summary
With this guide, you can have a working environment that can use containers based on Red Hat Enterprise Linux 7.1, whether you are using Mac OS X®, Microsoft Windows®Or other Linux releases.
Thanks
Special thanks to the support and help provided by Pete parse on Vagrant settings.
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10
Installing Red Hat Container Development Kit on Mac OS X
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-05/117951.htm