Important
Chapter 10. Working with Containers
10.1. Managing Cont ainers
The following s e ctions s how how to cre ate , vie w, s tart, s top, and commit a containe r.
Prerequisit es
In Re d Hat Sate llite , you can de ploy containe rs only on a compute re s ource of the Docke r provide r type . The re fore , whe n you atte mpt to vie w or cre ate containe rs for the firs t time , Sate llite prompts you to cre ate a Docke r compute re s ource . To do s o, firs t cre ate a
containe r hos t as de s cribe d in Proce dure 10.1, “To Pre pare a Containe r Hos t:”, the n s pe cify this hos t as a compute re s ource as de s cribe d in Proce dure 10.2, “To Cre ate a Docke r Compute Re s ource :”.
Pro cedure 10 .1. T o Prepare a Co nt ainer Ho st :
1. Pre pare a Re d Hat Ente rpris e Linux 7 s e rve r for hos ting image s and e nable the docker s e rvice on this s e rve r as de s cribe d in the Getting Docker in RHEL 7 s e ction of the Ge t Starte d with Docke r Formatte d Containe r Image s on Re d Hat Sys te ms
guide on the Re d Hat Cus tome r Portal . You can de ploy the containe r hos t e ithe r on the s ame machine as the Sate llite s e rve r or inde pe nde ntly.
Note
Re d Hat Ente rpris e Linux 7 is curre ntly the only s upporte d s ys te m for a containe r hos t. The docker package is available in the rhe l-7-s e rve r-e xtras - rpms re pos itory. Re d Hat Ente rpris e Linux 6 s ys te ms are curre ntly not s upporte d to hos t containe rs .
2. Run the following command on the containe r hos t to ins tall the Sate llite s e rve r's CA ce rtificate :
rpm -Uvh https://satellite.example.com/pub/katello-ca-consumer- latest.noarch.rpm
He re , satellite.example.com is the fully qualifie d domain name of your Sate llite s e rve r. Skip this s te p if the containe r hos t is alre ady re gis te re d as a Sate llite hos t. 3. De pe nding on the location of the containe r hos t, pe rform the following tas ks :
A. If the containe r hos t is on the s ame machine as the Sate llite s e rve r: a. Cre ate a docke r us e r group and add the fore man us e r to it:
# groupadd docker
# usermod -aG docker foreman
b. Modify the OPTIONS variable in the /etc/sysconfig/docker file as follows :
OPTIONS='--selinux-enabled -G docker' c. Re s tart the affe cte d s e rvice s to apply the change s :
# systemctl restart docker.service # katello-service restart
B. If the containe r hos t is on a diffe re nt machine than the Sate llite s e rve r: [2]
a. Ope n a port on the containe r hos t to communicate with the Sate llite s e rve r. To do s o, modify the OPTIONS variable in the
/etc/sysconfig/docker file as follows :
OPTIONS='--selinux-enabled -H tcp://0.0.0.0:port_number -H unix:///var/run/docker.sock'
Re place port_number with a s e le cte d port numbe r.
b. Re s tart the docke r s e rvice and ve rify your s e ttings as follows : # systemctl restart docker.service
# systemctl status docker.service Pro cedure 10 .2. T o Creat e a Do cker Co mput e Reso urce:
1. Make s ure the port 5000 is e nable d on the Sate llite s e rve r. The containe r hos t us e s this port to pull image s from Conte nt Vie ws on the Sate llite s e rve r.
2. Cre ate the compute re s ource as de s cribe d in Proce dure 13.9, “To Add a Compute Re s ource :”. Spe cify the re s ource URL according to the location of the containe r hos t:
a. If the containe r hos t is on the s ame machine as the Sate llite s e rve r, s e t unix://var/run/docker.sock as the re s ource URL.
b. If the containe r hos t is on a diffe re nt machine than the Sate llite s e rve r, s pe cify the URL in the form of:
http://container_host_fqdn:port_number
He re , container_host_fqdn and port_number s tand for the fully qualifie d domain name of the containe r hos t and the port numbe r ope ne d on the containe r hos t for communication with Sate llite .
3. Click Test Connection to te s t if the containe r hos t is available . 4. Click Submit to cre ate the compute re s ource .
10.1.1. Creat ing Cont ainers
Whe n the re is at le as t one Docke r compute re s ource pre s e nt in your Sate llite , you can cre ate containe rs . To cre ate a ne w containe r, follow the s te ps de s cribe d in
Proce dure 10.3, “To Cre ate a Containe r:”. For ins tructions on how to monitor e xis ting containe rs , s e e Se ction 10.1.2, “Monitoring Containe rs ”.
To cre ate a containe r, you mus t firs t import an image , which can be a platform image or a pre vious ly cre ate d laye re d image . Sate llite s upports the following image s ource s :
Lo cal co nt ent : re pre s e nte d by the Katello option whe n cre ating a containe r. This option allows you to import an image from a re pos itory that is alre ady pre s e nt on a caps ule s e rve r in a ce rtain conte nt vie w and life cycle e nvironme nt. For more
information on how to cre ate and populate a local re gis try, s e e Se ction 10.2, “Managing Re pos itorie s ”.
Do cker Hub: allows you to s e arch the Docke r Hub re gis try and pull image s from the re .
Ext ernal Regist ry: allows you to import image s from a pre vious ly cre ate d e xte rnal
re gis try. For more information on cre ating re gis trie s in Re d Hat Sate llite , s e e
Se ction 10.3, “Importing Exte rnal Re gis trie s ”.
Note
You cannot change the configuration of an e xis ting containe r. To alte r the
configuration, you have to cre ate a re place me nt containe r with modifie d s e ttings as de s cribe d in Proce dure 10.3, “To Cre ate a Containe r:”. The re fore , make s ure that containe rs can be e as ily re place d in your workflow.
Pro cedure 10 .3. T o Creat e a Co nt ainer:
1. Navigate to Co nt ainers → New Co nt ainer. Alte rnative ly, navigate to Co nt ainers