From b51d7f6ac2d65f72ac9586294041b5d0c4ed62a0 Mon Sep 17 00:00:00 2001 From: Shashi Mazumdar Date: Wed, 2 Sep 2020 06:56:12 +0000 Subject: [PATCH 1/3] Adding new Dockerfile that can be use to build any Centos 7.x docker image for use with Clusterdock. --- images/centos7.x/Dockerfile | 53 +++++++++++++++++++++++++++++++++ images/centos7.x/readme.txt | 5 ++++ images/centos7.x/ssh/id_rsa | 27 +++++++++++++++++ images/centos7.x/ssh/id_rsa.pub | 1 + 4 files changed, 86 insertions(+) create mode 100644 images/centos7.x/Dockerfile create mode 100644 images/centos7.x/readme.txt create mode 100644 images/centos7.x/ssh/id_rsa create mode 100644 images/centos7.x/ssh/id_rsa.pub diff --git a/images/centos7.x/Dockerfile b/images/centos7.x/Dockerfile new file mode 100644 index 0000000..7026a41 --- /dev/null +++ b/images/centos7.x/Dockerfile @@ -0,0 +1,53 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG BASE_IMAGE=centos:7.8.2003 +FROM ${BASE_IMAGE} +ENV container docker + +# Delete a number of unit files which might cause issues. +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ +systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +# Install useful things that are missing from the centos:7.4.1708 image. +RUN yum install -y initscripts \ + openssh-clients \ + openssh-server \ + rsyslog \ + sudo \ + wget \ + which && \ + yum clean all + +# Add pre-created SSH keys into .ssh folder. +ADD ssh /root/.ssh/ + +# Copy public key into authorized_keys and limit access to the private key to ensure SSH can use it. +RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \ + chmod 600 /root/.ssh/id_rsa + +# The official CentOS Docker images retain the inclusion of the 20-nproc.conf file that only applies on a real machine. +# This file overrides reasonable defaults for things like the maximum number of user processes when running commands +# as a non-root user. Get rid of it (and see tinyurl.com/zqdfzpg). +RUN rm /etc/security/limits.d/20-nproc.conf + +# Disable strict host key checking to /dev/null to make SSH between containers less of a pain. +RUN sed -i -r "s|^Host \*\s*|&\n StrictHostKeyChecking no|" /etc/ssh/ssh_config + +CMD ["/usr/sbin/init"] diff --git a/images/centos7.x/readme.txt b/images/centos7.x/readme.txt new file mode 100644 index 0000000..b6ff875 --- /dev/null +++ b/images/centos7.x/readme.txt @@ -0,0 +1,5 @@ +To build a centos 7.x image, use the folowing command. + +docker build . -t clusterdock/topology_nodebase:centos7.8 --build-arg BASE_IMAGE=centos7.8.2003 + +The build-arg BASE_IMAGE can take any valid centos 7.x tags from the official centos repo on docker hub. diff --git a/images/centos7.x/ssh/id_rsa b/images/centos7.x/ssh/id_rsa new file mode 100644 index 0000000..f2677cc --- /dev/null +++ b/images/centos7.x/ssh/id_rsa @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAtj/yZZNF+bv26eqWqsx+vFehSlxBJp/QhIrFWKpjHcpQJ29o +6hJN9moU3Goft2C5w6FoZdjC1TWlzhxUnRS8xeksFnW3ItvkjySLA1Iq6jchYxNd +fZ3HwTdH0rubM1uJ/CnkaijoxBqGBmPSL0TxfqcteaJ8APhslwl0WWJ6b+tBCHDV +pTLATebtggCAfhKmSuAYmn3QIqJ7DFoSGkwhkxpUHuuVCZxUH3CIxLIw+6npArr/ +S5gtFo50oi6FXPmvv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3Z5Ai6vdWdK6qT1SUOht+ +s9YLnVzqtWqZoTMNpS+34N0hy0wj1ZRpZRTYBGmSpMA+6gc38/EQVZyw6E2jH+Yu +MEmqaQKBgQDGh9uXCl/WjhBOF9VLrX/Aeaa2Mzrh21Ic1dw6aWrE4EW6k1LvSP36 +evrvrs2jQuzRMGH6DKX8ImnVEWjK+gZfgf2MuyDSW7KYR5zxkdZtRkotF6X0fu6N +8uLa7CN8UmS4FiAMLwNbTJ6zA6ohny7r+AiOqNGlP9vBFMhpGs3NFg== +-----END RSA PRIVATE KEY----- diff --git a/images/centos7.x/ssh/id_rsa.pub b/images/centos7.x/ssh/id_rsa.pub new file mode 100644 index 0000000..bcdf453 --- /dev/null +++ b/images/centos7.x/ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2P/Jlk0X5u/bp6paqzH68V6FKXEEmn9CEisVYqmMdylAnb2jqEk32ahTcah+3YLnDoWhl2MLVNaXOHFSdFLzF6SwWdbci2+SPJIsDUirqNyFjE119ncfBN0fSu5szW4n8KeRqKOjEGoYGY9IvRPF+py15onwA+GyXCXRZYnpv60EIcNWlMsBN5u2CAIB+EqZK4BiafdAionsMWhIaTCGTGlQe65UJnFQfcIjEsjD7qekCuv9LmC0WjnSiLoVc+a+/qYmDrIuqrdWUpxCHp38I5omikef6ct53aQQIRJSWlOu4ymvohwYRKDPiGeSaGinyhNjjaxAmE88XYCGr1rdp clusterdock From 3082a716f164b4f52b4c882eae0424985dbb4cd5 Mon Sep 17 00:00:00 2001 From: Shashi Mazumdar Date: Wed, 2 Sep 2020 17:31:59 +0000 Subject: [PATCH 2/3] Changes to address reviews comments. --- images/centos7.4/Dockerfile | 52 --------------------------------- images/centos7.4/ssh/id_rsa | 27 ----------------- images/centos7.4/ssh/id_rsa.pub | 1 - images/centos7.x/README.rst | 22 ++++++++++++++ images/centos7.x/readme.txt | 5 ---- 5 files changed, 22 insertions(+), 85 deletions(-) delete mode 100644 images/centos7.4/Dockerfile delete mode 100644 images/centos7.4/ssh/id_rsa delete mode 100644 images/centos7.4/ssh/id_rsa.pub create mode 100644 images/centos7.x/README.rst delete mode 100644 images/centos7.x/readme.txt diff --git a/images/centos7.4/Dockerfile b/images/centos7.4/Dockerfile deleted file mode 100644 index d4a082b..0000000 --- a/images/centos7.4/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM centos:7.4.1708 -ENV container docker - -# Delete a number of unit files which might cause issues. -RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ -systemd-tmpfiles-setup.service ] || rm -f $i; done); \ -rm -f /lib/systemd/system/multi-user.target.wants/*;\ -rm -f /etc/systemd/system/*.wants/*;\ -rm -f /lib/systemd/system/local-fs.target.wants/*; \ -rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ -rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ -rm -f /lib/systemd/system/basic.target.wants/*;\ -rm -f /lib/systemd/system/anaconda.target.wants/*; - -# Install useful things that are missing from the centos:7.4.1708 image. -RUN yum install -y initscripts \ - openssh-clients \ - openssh-server \ - rsyslog \ - sudo \ - wget \ - which && \ - yum clean all - -# Add pre-created SSH keys into .ssh folder. -ADD ssh /root/.ssh/ - -# Copy public key into authorized_keys and limit access to the private key to ensure SSH can use it. -RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \ - chmod 600 /root/.ssh/id_rsa - -# The official CentOS Docker images retain the inclusion of the 20-nproc.conf file that only applies on a real machine. -# This file overrides reasonable defaults for things like the maximum number of user processes when running commands -# as a non-root user. Get rid of it (and see tinyurl.com/zqdfzpg). -RUN rm /etc/security/limits.d/20-nproc.conf - -# Disable strict host key checking to /dev/null to make SSH between containers less of a pain. -RUN sed -i -r "s|^Host \*\s*|&\n StrictHostKeyChecking no|" /etc/ssh/ssh_config - -CMD ["/usr/sbin/init"] diff --git a/images/centos7.4/ssh/id_rsa b/images/centos7.4/ssh/id_rsa deleted file mode 100644 index f2677cc..0000000 --- a/images/centos7.4/ssh/id_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAtj/yZZNF+bv26eqWqsx+vFehSlxBJp/QhIrFWKpjHcpQJ29o -6hJN9moU3Goft2C5w6FoZdjC1TWlzhxUnRS8xeksFnW3ItvkjySLA1Iq6jchYxNd -fZ3HwTdH0rubM1uJ/CnkaijoxBqGBmPSL0TxfqcteaJ8APhslwl0WWJ6b+tBCHDV -pTLATebtggCAfhKmSuAYmn3QIqJ7DFoSGkwhkxpUHuuVCZxUH3CIxLIw+6npArr/ -S5gtFo50oi6FXPmvv6mJg6yLqq3VlKcQh6d/COaJopHn+nLed2kECESUlpTruMpr -6IcGESgz4hnkmhop8oTY42sQJhPPF2Ahq9a3aQIDAQABAoIBADSbxPb5SkvKrH3d -j9yB51uq2A5FDzF9FI4OGOV9WdsxmW2oxVo8KnElMhxmLf2bWERWhXJQ3fz53YDf -wLUPVWaz5lwdYt4XJ6UCYXZ185lkjKiy4FvwfccSlBMKwMRUekJmPV8/q+Ff3qxd -iEDI4AU1cPUZqD4HeCEpQ4LB4KIJhCdLkCgoWxxaCwwuB6DnwB4P4VLeAfsm2NEX -k9dld87q/miOmuw9QsmSv9wYiQqoPdV5Qj7KYqHBAa6syqUfFni3Ibmw1WBzMydp -8YyP9HvrzDBMnPPzkmp6od0fAgGafIlkIxz/9sCKOSISnuuqahbNAJK/rIiJzLY3 -Pi49M+ECgYEA2vCFObmM/hpKUPNxG841nQScFfeMg1q1z1krEmfjqDTELXyq9AOS -fGiVTxfWagOGoAWIwg3ZfgGEmxsKrOSxkFvabWdhN1Wn98Zf8fJG8YAwLYg8JOgf -gZ5pkxFW4FwrAeFDyJyKvFJVrbDw1PM41yvTmRzf3NjcaqJrBE2fgKUCgYEA1RmF -XjfMlBoMLZ4pXS1zF91WgOF4SNdJJj9RCGzqqdy+DzPKNAZVa0HBhaIHCZXL3Hcv -zqgEb6RSMysyVYjZPwfSwevsSuxpfriVpYux5MN3AEXX5Ysv51WWStWgt9+iQlfo -xAdxxukOa++PZ4Z+TIIEDAFS47rnKEQUh+ZNfHUCgYEA0amTa3wtcQlsMalvn9kR -rpRDhSXTAddUVIRnovCqKuKdG5JPg+4H0eu1UFDbnBpUSdoC5RKuPOTnQEHdL0Sy -ZjQQMMTXbE4y1Cy8pM4G8i539KKKNi20PkSdhaENOT4KUXqPlwWSNlYChprzhnqE -7EmkEPR9zNg//D4djbloDaECgYANOJIfsFKO9ba/tcpXL5SubFsLj/GIg2LUbqU2 -YpuEgl+ATfRDmgj+qIu7ILxTCeol+XcL2Ty9OHKpHgr3Z5Ai6vdWdK6qT1SUOht+ -s9YLnVzqtWqZoTMNpS+34N0hy0wj1ZRpZRTYBGmSpMA+6gc38/EQVZyw6E2jH+Yu -MEmqaQKBgQDGh9uXCl/WjhBOF9VLrX/Aeaa2Mzrh21Ic1dw6aWrE4EW6k1LvSP36 -evrvrs2jQuzRMGH6DKX8ImnVEWjK+gZfgf2MuyDSW7KYR5zxkdZtRkotF6X0fu6N -8uLa7CN8UmS4FiAMLwNbTJ6zA6ohny7r+AiOqNGlP9vBFMhpGs3NFg== ------END RSA PRIVATE KEY----- diff --git a/images/centos7.4/ssh/id_rsa.pub b/images/centos7.4/ssh/id_rsa.pub deleted file mode 100644 index bcdf453..0000000 --- a/images/centos7.4/ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2P/Jlk0X5u/bp6paqzH68V6FKXEEmn9CEisVYqmMdylAnb2jqEk32ahTcah+3YLnDoWhl2MLVNaXOHFSdFLzF6SwWdbci2+SPJIsDUirqNyFjE119ncfBN0fSu5szW4n8KeRqKOjEGoYGY9IvRPF+py15onwA+GyXCXRZYnpv60EIcNWlMsBN5u2CAIB+EqZK4BiafdAionsMWhIaTCGTGlQe65UJnFQfcIjEsjD7qekCuv9LmC0WjnSiLoVc+a+/qYmDrIuqrdWUpxCHp38I5omikef6ct53aQQIRJSWlOu4ymvohwYRKDPiGeSaGinyhNjjaxAmE88XYCGr1rdp clusterdock diff --git a/images/centos7.x/README.rst b/images/centos7.x/README.rst new file mode 100644 index 0000000..52d3f72 --- /dev/null +++ b/images/centos7.x/README.rst @@ -0,0 +1,22 @@ + +Instructions to build Centos 7.x images to use in a clusterdock topology +======================================================================== + +To build a centos 7.x image, use the folowing command. + +`` +docker build . -t clusterdock/topology_nodebase:centos7.8 --build-arg BASE_IMAGE=centos7.8.2003 +`` + +The build-arg BASE_IMAGE can take any valid centos 7.x tags from the official centos repo on docker hub. Some examples +are + +========== =============== +Version Tag +========== =============== +Centos 7.4 centos7.4.1708 +Centos 7.5 centos7.5.1804 +Centos 7.6 centos7.6.1810 +Centos 7.8 centos7.8.2003 +========== =============== + diff --git a/images/centos7.x/readme.txt b/images/centos7.x/readme.txt deleted file mode 100644 index b6ff875..0000000 --- a/images/centos7.x/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ -To build a centos 7.x image, use the folowing command. - -docker build . -t clusterdock/topology_nodebase:centos7.8 --build-arg BASE_IMAGE=centos7.8.2003 - -The build-arg BASE_IMAGE can take any valid centos 7.x tags from the official centos repo on docker hub. From 4f20f2452166802230db41f9dbf60a970c1d5527 Mon Sep 17 00:00:00 2001 From: Shashi Mazumdar Date: Wed, 2 Sep 2020 10:34:31 -0700 Subject: [PATCH 3/3] Update README.rst --- images/centos7.x/README.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/images/centos7.x/README.rst b/images/centos7.x/README.rst index 52d3f72..00ebf3d 100644 --- a/images/centos7.x/README.rst +++ b/images/centos7.x/README.rst @@ -4,9 +4,7 @@ Instructions to build Centos 7.x images to use in a clusterdock topology To build a centos 7.x image, use the folowing command. -`` -docker build . -t clusterdock/topology_nodebase:centos7.8 --build-arg BASE_IMAGE=centos7.8.2003 -`` +``docker build . -t clusterdock/topology_nodebase:centos7.8 --build-arg BASE_IMAGE=centos7.8.2003`` The build-arg BASE_IMAGE can take any valid centos 7.x tags from the official centos repo on docker hub. Some examples are