Changes

From SME Server
Jump to navigationJump to search
5,884 bytes added ,  22:56, 15 September 2014
no edit summary
Line 116: Line 116:  
* Time based by cron
 
* Time based by cron
 
* Triggered by an event
 
* Triggered by an event
 +
 +
==Create a SME docker Base image==
 +
 +
WIP --[[User:Stephdl|Stephdl]] ([[User talk:Stephdl|talk]]) 15:56, 15 September 2014 (MDT)
 +
'''Install docker to your sme, be aware that you have to do it on a 64 bit'''
 +
 +
Create your repository file and save it to /root/repo_file
 +
 +
#------------------------------------------------------------
 +
#       !!DO NOT MODIFY THIS FILE!!
 +
#
 +
# Manual changes will be lost when this file is regenerated.
 +
#
 +
# Please read the developer's guide, which is available
 +
# at http://www.contribs.org/development/
 +
#
 +
# Copyright (C) 1999-2006 Mitel Networks Corporation
 +
#------------------------------------------------------------
 +
 +
[base]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
 +
name=CentOS - os
 +
gpgcheck=0
 +
enablegroups=1
 +
exclude=initscripts libgsf
 +
 +
[centosplus]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
 +
name=CentOS - centosplus
 +
gpgcheck=0
 +
enablegroups=0
 +
 +
[contrib]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
 +
name=CentOS - contrib
 +
gpgcheck=0
 +
enablegroups=0
 +
 +
[extras]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
 +
name=CentOS - extras
 +
gpgcheck=0
 +
enablegroups=0
 +
 +
[fasttrack]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack
 +
name=CentOS - fasttrack
 +
gpgcheck=0
 +
enablegroups=0
 +
 +
[smeaddons]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smeaddons-9
 +
name=SME Server - addons
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smecontribs]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smecontribs-9
 +
name=SME Server - contribs
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smedev]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smedev-9
 +
name=SME Server - dev
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smeextras]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smeextras-9
 +
name=SME Server - extras
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smeos]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smeos-9
 +
name=SME Server - os
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smetest]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smetest-9
 +
name=SME Server - test
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smeupdates]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smeupdates-9
 +
name=SME Server - updates
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[smeupdates-testing]
 +
enabled=0
 +
mirrorlist=http://mirrorlist.contribs.org/mirrorlist/smeupdates-testing-9
 +
name=SME Server - updates testing
 +
gpgcheck=0
 +
enablegroups=1
 +
 +
[updates]
 +
enabled=1
 +
mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates
 +
name=CentOS - updates
 +
gpgcheck=0
 +
enablegroups=1
 +
exclude=initscripts libgsf
 +
 +
 +
* first create a file and record the content
 +
 +
vim /root/docker_images
 +
 +
#!/usr/bin/env bash
 +
#
 +
# Create a base CentOS Docker image.
 +
#
 +
# This script is useful on systems with yum installed (e.g., building
 +
# a CentOS image on CentOS). See contrib/mkimage-rinse.sh for a way
 +
# to build CentOS images on other systems.
 +
usage() {
 +
cat <<EOOPTS
 +
$(basename $0) [OPTIONS] <name>
 +
OPTIONS:
 +
-y <yumconf> The path to the yum config to install packages from. The
 +
default is /etc/yum.conf.
 +
EOOPTS
 +
exit 1
 +
}
 +
# option defaults
 +
yum_config=/etc/yum.conf
 +
while getopts ":y:h" opt; do
 +
case $opt in
 +
y)
 +
yum_config=$OPTARG
 +
;;
 +
h)
 +
usage
 +
;;
 +
\?)
 +
echo "Invalid option: -$OPTARG"
 +
usage
 +
;;
 +
esac
 +
done
 +
shift $((OPTIND - 1))
 +
name=$1
 +
if [[ -z $name ]]; then
 +
usage
 +
fi
 +
#--------------------
 +
target=$(mktemp -d --tmpdir $(basename $0).XXXXXX)
 +
set -x
 +
mkdir -m 755 "$target"/dev
 +
mknod -m 600 "$target"/dev/console c 5 1
 +
mknod -m 600 "$target"/dev/initctl p
 +
mknod -m 666 "$target"/dev/full c 1 7
 +
mknod -m 666 "$target"/dev/null c 1 3
 +
mknod -m 666 "$target"/dev/ptmx c 5 2
 +
mknod -m 666 "$target"/dev/random c 1 8
 +
mknod -m 666 "$target"/dev/tty c 5 0
 +
mknod -m 666 "$target"/dev/tty0 c 4 0
 +
mknod -m 666 "$target"/dev/urandom c 1 9
 +
mknod -m 666 "$target"/dev/zero c 1 5
 +
#yum -c "$yum_config" --installroot="$target" --setopt=tsflags=nodocs \
 +
#--setopt=group_package_types=mandatory -y groupinstall Core
 +
#yum -c "/root/repo_file" --installroot="$target" --setopt=tsflags=nodocs --setopt=group_package_types=mandatory -y groupinstall Core ###this line is to test and build a pure centos base in order to test
 +
yum -c "/root/repo_file" --installroot="$target" --setopt=tsflags=nodocs --setopt=group_package_types=mandatory -y install --disablerepo=* --enablerepo=smeos,smeextras e-smith\* smeserver\*
 +
 +
yum -c "/root/repo_file" --installroot="$target" -y clean all
 +
 +
 +
 +
cat > "$target"/etc/sysconfig/network <<EOF
 +
NETWORKING=yes
 +
HOSTNAME=localhost.localdomain
 +
EOF
 +
 +
# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb
 +
# --keep-services "$target". Stolen from mkimage-rinse.sh
 +
# locales
 +
rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
 +
# docs
 +
rm -rf "$target"/usr/share/{man,doc,info,gnome/help}
 +
# cracklib
 +
rm -rf "$target"/usr/share/cracklib
 +
# i18n
 +
rm -rf "$target"/usr/share/i18n
 +
# sln
 +
rm -rf "$target"/sbin/sln
 +
# ldconfig
 +
rm -rf "$target"/etc/ld.so.cache
 +
rm -rf "$target"/var/cache/ldconfig/*
 +
 +
#version=
 +
 +
if [ -r "$target"/etc/redhat-release ]; then
 +
version="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' "$target"/etc/redhat-release)"
 +
fi
 +
 +
if [ -z "$version" ]; then
 +
echo >&2 "warning: cannot autodetect OS version, using '$name' as tag"
 +
version=$name
 +
fi
 +
 +
tar --numeric-owner -c -C "$target" . | docker import - $name:$version
 +
docker run -i -t $name:$version echo success
 +
rm -rf "$target"
 +
 +
 +
give the permissions to the file
 +
 +
chmod u+x /root/docker_images
 +
and launch the script
 +
/root/docker_images [name_of_your_image]

Navigation menu