2 # Docker specific functions
4 ################################################################
6 # Copyright (c) 2015 Oleg Girko
7 # Copyright (c) 2015 SUSE Linux Products GmbH
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2 or 3 as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program (see the file COPYING); if not, write to the
20 # Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 ################################################################
25 vm_verify_options_docker() {
31 local name="obsbuild.${BUILD_ROOT##*/}"
32 local vm_init_script_docker="/.build/build"
33 local docker_server=`cat /etc/hosts | grep docker | cut -f 1`
34 local docker_port=`cat /etc/hosts | grep docker | cut -f 2`
35 docker_port=${docker_port#docker}
36 docker -H $docker_server:$docker_port rm --privileged "$name" >/dev/null 2>&1 || true
37 docker -H $docker_server:$docker_port run --privileged\
38 --rm --name "$name" --cap-add=sys_admin --net=none \
39 -v "$BUILD_ROOT:/mnt" busybox /bin/chroot /mnt "$vm_init_script_docker"
41 test "$BUILDSTATUS" != 255 || BUILDSTATUS=3
42 cleanup_and_exit "$BUILDSTATUS"
46 local name="obsbuild.${BUILD_ROOT##*/}"
47 docker stop -t 2 "$name" || true
54 vm_attach_root_docker() {
58 vm_attach_swap_docker() {
62 vm_detach_root_docker() {
66 vm_detach_swap_docker() {