[why] our os-cifs container will mount three dir, /srv/os, /srv/initrd, /srv/result in order to reduce the coupling, need split them
[how] one folder mount by one container
[usage] mount -t cifs o guest,port=447 //ip/result /tmp/result
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com --- container/result-cifs/Dockerfile | 22 ++++++++++++++++++++++ container/result-cifs/build | 5 +++++ container/result-cifs/smb.conf | 29 +++++++++++++++++++++++++++++ container/result-cifs/start | 24 ++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 container/result-cifs/Dockerfile create mode 100755 container/result-cifs/build create mode 100644 container/result-cifs/smb.conf create mode 100755 container/result-cifs/start
diff --git a/container/result-cifs/Dockerfile b/container/result-cifs/Dockerfile new file mode 100644 index 0000000..a0d47c2 --- /dev/null +++ b/container/result-cifs/Dockerfile @@ -0,0 +1,22 @@ +# Origin: https://github.com/Stanback/alpine-samba +# Copyright (C) 2016-2020 Eric D. Stanback +# SPDX-License-Identifier: GPL-3.0 + +FROM alpine:edge + +MAINTAINER Xiao Shenwei xiaoshenwei96@163.com + +RUN sed -ri.origin 's|^https?://dl-cdn.alpinelinux.org|http://mirrors.huaweicloud.com%7Cg' /etc/apk/repositories +RUN adduser -u 1090 -D lkp +RUN apk add --update \ + samba-common-tools \ + samba-client \ + samba-server \ + bash +RUN rm -rf /var/cache/apk/* + +COPY ./smb.conf /etc/samba/ + +EXPOSE 447/tcp + +ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] diff --git a/container/result-cifs/build b/container/result-cifs/build new file mode 100755 index 0000000..d97b6dd --- /dev/null +++ b/container/result-cifs/build @@ -0,0 +1,5 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +docker build -t result-cifs . diff --git a/container/result-cifs/smb.conf b/container/result-cifs/smb.conf new file mode 100644 index 0000000..4ccd943 --- /dev/null +++ b/container/result-cifs/smb.conf @@ -0,0 +1,29 @@ +# refer to https://lkml.org/lkml/2019/7/16/716 and https://lkml.org/lkml/2019/9/19/586 +[global] + workgroup = MYGROUP + server string = Samba Server + map to guest = Bad User + load printers = no + printing = bsd + printcap name = /dev/null + disable spoolss = yes + disable netbios = yes + server role = standalone + server services = -dns, -nbt + smb ports = 445 + create mode = 0777 + directory mode = 0777 + guest only = yes + guest ok = yes + server min protocol = NT1 + unix extensions = yes + mangled names = no + +[result] + path = /srv/result/ + comment = result + browseable = yes + writable = yes + public = yes + force user = lkp + force group = lkp diff --git a/container/result-cifs/start b/container/result-cifs/start new file mode 100755 index 0000000..2d6acba --- /dev/null +++ b/container/result-cifs/start @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +. $CCI_SRC/container/defconfig.sh + +lsmod | grep -q "^cifs\s" || { + sudo modprobe cifs +} + +docker_rm result-cifs + +cmd=( + docker run + -d + -p 447:445 + -v /etc/localtime:/etc/localtime:ro + -v /srv/result:/srv/result + --name result-cifs + --restart=always + result-cifs +) + +"${cmd[@]}"
On Tue, Nov 24, 2020 at 02:43:12PM +0800, Xiao Shenwei wrote:
[why] our os-cifs container will mount three dir, /srv/os, /srv/initrd, /srv/result in order to reduce the coupling, need split them
[how] one folder mount by one container
[usage] mount -t cifs o guest,port=447 //ip/result /tmp/result
^-- o => -o ?
-------- Thanks Yu Chuan
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
container/result-cifs/Dockerfile | 22 ++++++++++++++++++++++ container/result-cifs/build | 5 +++++ container/result-cifs/smb.conf | 29 +++++++++++++++++++++++++++++ container/result-cifs/start | 24 ++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 container/result-cifs/Dockerfile create mode 100755 container/result-cifs/build create mode 100644 container/result-cifs/smb.conf create mode 100755 container/result-cifs/start
diff --git a/container/result-cifs/Dockerfile b/container/result-cifs/Dockerfile new file mode 100644 index 0000000..a0d47c2 --- /dev/null +++ b/container/result-cifs/Dockerfile @@ -0,0 +1,22 @@ +# Origin: https://github.com/Stanback/alpine-samba +# Copyright (C) 2016-2020 Eric D. Stanback +# SPDX-License-Identifier: GPL-3.0
+FROM alpine:edge
+MAINTAINER Xiao Shenwei xiaoshenwei96@163.com
+RUN sed -ri.origin 's|^https?://dl-cdn.alpinelinux.org|http://mirrors.huaweicloud.com%7Cg' /etc/apk/repositories +RUN adduser -u 1090 -D lkp +RUN apk add --update \
- samba-common-tools \
- samba-client \
- samba-server \
- bash
+RUN rm -rf /var/cache/apk/*
+COPY ./smb.conf /etc/samba/
+EXPOSE 447/tcp
+ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] diff --git a/container/result-cifs/build b/container/result-cifs/build new file mode 100755 index 0000000..d97b6dd --- /dev/null +++ b/container/result-cifs/build @@ -0,0 +1,5 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+docker build -t result-cifs . diff --git a/container/result-cifs/smb.conf b/container/result-cifs/smb.conf new file mode 100644 index 0000000..4ccd943 --- /dev/null +++ b/container/result-cifs/smb.conf @@ -0,0 +1,29 @@ +# refer to https://lkml.org/lkml/2019/7/16/716 and https://lkml.org/lkml/2019/9/19/586 +[global]
- workgroup = MYGROUP
- server string = Samba Server
- map to guest = Bad User
- load printers = no
- printing = bsd
- printcap name = /dev/null
- disable spoolss = yes
- disable netbios = yes
- server role = standalone
- server services = -dns, -nbt
- smb ports = 445
- create mode = 0777
- directory mode = 0777
- guest only = yes
- guest ok = yes
- server min protocol = NT1
- unix extensions = yes
- mangled names = no
+[result]
- path = /srv/result/
- comment = result
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
diff --git a/container/result-cifs/start b/container/result-cifs/start new file mode 100755 index 0000000..2d6acba --- /dev/null +++ b/container/result-cifs/start @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+. $CCI_SRC/container/defconfig.sh
+lsmod | grep -q "^cifs\s" || {
- sudo modprobe cifs
+}
+docker_rm result-cifs
+cmd=(
- docker run
- -d
- -p 447:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/result:/srv/result
- --name result-cifs
- --restart=always
- result-cifs
+)
+"${cmd[@]}"
2.23.0