[why] our os-cifs container will mount three dir, /srv/os /srv/initrd /srv/result it's may cause: 1. our cifs service becomes slow 2. if the container exit, none of the three folders can be accessed. in order to reduce the coupling, need split them [how] one folder mount by one container
usage: mount /srv/initrd client: mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd client: mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com --- container/initrd-cifs/Dockerfile | 24 +++++++++++++++++++++ container/initrd-cifs/build | 5 +++++ container/initrd-cifs/smb.conf | 36 ++++++++++++++++++++++++++++++++ container/initrd-cifs/start | 24 +++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 container/initrd-cifs/Dockerfile create mode 100755 container/initrd-cifs/build create mode 100644 container/initrd-cifs/smb.conf create mode 100755 container/initrd-cifs/start
diff --git a/container/initrd-cifs/Dockerfile b/container/initrd-cifs/Dockerfile new file mode 100644 index 0000000..9590701 --- /dev/null +++ b/container/initrd-cifs/Dockerfile @@ -0,0 +1,24 @@ +# 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 && \ + rm -rf /var/cache/apk/* + +COPY ./smb.conf /etc/samba/ + +EXPOSE 446/tcp + +ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] diff --git a/container/initrd-cifs/build b/container/initrd-cifs/build new file mode 100755 index 0000000..ca9de39 --- /dev/null +++ b/container/initrd-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 alpine/initrd-cifs . diff --git a/container/initrd-cifs/smb.conf b/container/initrd-cifs/smb.conf new file mode 100644 index 0000000..43d2b78 --- /dev/null +++ b/container/initrd-cifs/smb.conf @@ -0,0 +1,36 @@ +# 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 +[initrd] + path = /srv/initrd/ + comment = initrd + browseable = yes + writable = yes + public = yes + force user = lkp + force group = lkp +[osimage] + path = /srv/initrd/ + comment = initrd + browseable = yes + writable = yes + public = yes + force user = lkp + force group = lkp diff --git a/container/initrd-cifs/start b/container/initrd-cifs/start new file mode 100755 index 0000000..a9dbc48 --- /dev/null +++ b/container/initrd-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 initrd-cifs + +cmd=( + docker run + -dt + -p 446:445 + -v /etc/localtime:/etc/localtime:ro + -v /srv/initrd:/srv/initrd + --name initrd-cifs + --restart=always + alpine/initrd-cifs +) + +"${cmd[@]}"
On Thu, Nov 12, 2020 at 02:46:27PM +0800, Xiao Shenwei wrote:
[why] our os-cifs container will mount three dir, /srv/os /srv/initrd /srv/result it's may cause: 1. our cifs service becomes slow 2. if the container exit, none of the three folders can be accessed. in order to reduce the coupling, need split them
The space at the beginning of the line is unnecessary.
[how] one folder mount by one container
ditto.
usage: mount /srv/initrd client: mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd client: mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
how about:
[Usage] Two ways for the client to mount initrd: 1. initrd. mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd 2. osimage. mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
Btw, maybe you should add the comment about why we need osimage and initrd to share the same folder. you can find the reason in os-nfs/start
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
container/initrd-cifs/Dockerfile | 24 +++++++++++++++++++++ container/initrd-cifs/build | 5 +++++ container/initrd-cifs/smb.conf | 36 ++++++++++++++++++++++++++++++++ container/initrd-cifs/start | 24 +++++++++++++++++++++
This patch looks only contain the 'add initrd-cifs step': desc: add the container/initrd-cifs to share /srv/initrd.
Is it better to also add the 'delete initrd-cifs step' in this patch? desc: delete the /srv/initrd in container/os-cifs.
+[initrd]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
+[osimage]
You can also add the reason why we need osimage and initrd here.
- path = /srv/initrd/
- comment = initrd
^-- osimage
-------- Thanks Yu Chuan
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
diff --git a/container/initrd-cifs/start b/container/initrd-cifs/start new file mode 100755 index 0000000..a9dbc48 --- /dev/null +++ b/container/initrd-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 initrd-cifs
+cmd=(
- docker run
- -dt
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0
On Thu, Nov 12, 2020 at 03:08:25PM +0800, Yu Chuan wrote:
On Thu, Nov 12, 2020 at 02:46:27PM +0800, Xiao Shenwei wrote:
[why] our os-cifs container will mount three dir, /srv/os /srv/initrd /srv/result it's may cause: 1. our cifs service becomes slow 2. if the container exit, none of the three folders can be accessed. in order to reduce the coupling, need split them
The space at the beginning of the line is unnecessary.
ok
[how] one folder mount by one container
ditto.
usage: mount /srv/initrd client: mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd client: mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
how about:
[Usage] Two ways for the client to mount initrd:
- initrd.
mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd 2. osimage. mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
Btw, maybe you should add the comment about why we need osimage and initrd to share the same folder. you can find the reason in os-nfs/start
good
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
container/initrd-cifs/Dockerfile | 24 +++++++++++++++++++++ container/initrd-cifs/build | 5 +++++ container/initrd-cifs/smb.conf | 36 ++++++++++++++++++++++++++++++++ container/initrd-cifs/start | 24 +++++++++++++++++++++
This patch looks only contain the 'add initrd-cifs step': desc: add the container/initrd-cifs to share /srv/initrd.
Is it better to also add the 'delete initrd-cifs step' in this patch? desc: delete the /srv/initrd in container/os-cifs.
ok
+[initrd]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
+[osimage]
You can also add the reason why we need osimage and initrd here.
- path = /srv/initrd/
- comment = initrd
^-- osimage
ok
Thanks, Shenwei
Thanks Yu Chuan
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
diff --git a/container/initrd-cifs/start b/container/initrd-cifs/start new file mode 100755 index 0000000..a9dbc48 --- /dev/null +++ b/container/initrd-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 initrd-cifs
+cmd=(
- docker run
- -dt
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0
On Thu, Nov 12, 2020 at 02:46:27PM +0800, Xiao Shenwei wrote:
[why] our os-cifs container will mount three dir, /srv/os /srv/initrd /srv/result it's may cause: 1. our cifs service becomes slow 2. if the container exit, none of the three folders can be accessed. in order to reduce the coupling, need split them [how] one folder mount by one container
usage: mount /srv/initrd client: mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd client: mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
container/initrd-cifs/Dockerfile | 24 +++++++++++++++++++++ container/initrd-cifs/build | 5 +++++ container/initrd-cifs/smb.conf | 36 ++++++++++++++++++++++++++++++++ container/initrd-cifs/start | 24 +++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 container/initrd-cifs/Dockerfile create mode 100755 container/initrd-cifs/build create mode 100644 container/initrd-cifs/smb.conf create mode 100755 container/initrd-cifs/start
diff --git a/container/initrd-cifs/Dockerfile b/container/initrd-cifs/Dockerfile new file mode 100644 index 0000000..9590701 --- /dev/null +++ b/container/initrd-cifs/Dockerfile @@ -0,0 +1,24 @@ +# 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 && \
- rm -rf /var/cache/apk/*
+COPY ./smb.conf /etc/samba/
+EXPOSE 446/tcp
+ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] diff --git a/container/initrd-cifs/build b/container/initrd-cifs/build new file mode 100755 index 0000000..ca9de39 --- /dev/null +++ b/container/initrd-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 alpine/initrd-cifs . diff --git a/container/initrd-cifs/smb.conf b/container/initrd-cifs/smb.conf new file mode 100644 index 0000000..43d2b78 --- /dev/null +++ b/container/initrd-cifs/smb.conf @@ -0,0 +1,36 @@ +# 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
Betterto add a blankline between different block of configuration.
+[initrd]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
ditto.
Thanks, Xijian
+[osimage]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
diff --git a/container/initrd-cifs/start b/container/initrd-cifs/start new file mode 100755 index 0000000..a9dbc48 --- /dev/null +++ b/container/initrd-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 initrd-cifs
+cmd=(
- docker run
- -dt
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0
On Thu, Nov 12, 2020 at 03:17:03PM +0800, Xu Xijian wrote:
On Thu, Nov 12, 2020 at 02:46:27PM +0800, Xiao Shenwei wrote:
[why] our os-cifs container will mount three dir, /srv/os /srv/initrd /srv/result it's may cause: 1. our cifs service becomes slow 2. if the container exit, none of the three folders can be accessed. in order to reduce the coupling, need split them [how] one folder mount by one container
usage: mount /srv/initrd client: mount -t cifs -o guest,port=446 //ip/initrd /tmp/initrd client: mount -t cifs -o guest,port=446 //ip/osimage /tmp/osimage
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
container/initrd-cifs/Dockerfile | 24 +++++++++++++++++++++ container/initrd-cifs/build | 5 +++++ container/initrd-cifs/smb.conf | 36 ++++++++++++++++++++++++++++++++ container/initrd-cifs/start | 24 +++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 container/initrd-cifs/Dockerfile create mode 100755 container/initrd-cifs/build create mode 100644 container/initrd-cifs/smb.conf create mode 100755 container/initrd-cifs/start
diff --git a/container/initrd-cifs/Dockerfile b/container/initrd-cifs/Dockerfile new file mode 100644 index 0000000..9590701 --- /dev/null +++ b/container/initrd-cifs/Dockerfile @@ -0,0 +1,24 @@ +# 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 && \
- rm -rf /var/cache/apk/*
+COPY ./smb.conf /etc/samba/
+EXPOSE 446/tcp
+ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] diff --git a/container/initrd-cifs/build b/container/initrd-cifs/build new file mode 100755 index 0000000..ca9de39 --- /dev/null +++ b/container/initrd-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 alpine/initrd-cifs . diff --git a/container/initrd-cifs/smb.conf b/container/initrd-cifs/smb.conf new file mode 100644 index 0000000..43d2b78 --- /dev/null +++ b/container/initrd-cifs/smb.conf @@ -0,0 +1,36 @@ +# 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
Betterto add a blankline between different block of configuration.
ok
Thanks, Shenwei
+[initrd]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
ditto.
Thanks, Xijian
+[osimage]
- path = /srv/initrd/
- comment = initrd
- browseable = yes
- writable = yes
- public = yes
- force user = lkp
- force group = lkp
diff --git a/container/initrd-cifs/start b/container/initrd-cifs/start new file mode 100755 index 0000000..a9dbc48 --- /dev/null +++ b/container/initrd-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 initrd-cifs
+cmd=(
- docker run
- -dt
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0
+++ b/container/initrd-cifs/Dockerfile @@ -0,0 +1,24 @@ +# 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
Unnecessary blank lines.
+RUN adduser -u 1090 -D lkp
Unnecessary blank lines.
+RUN apk add --update \
- samba-common-tools \
- samba-client \
- samba-server \
- bash && \
- rm -rf /var/cache/apk/*
+COPY ./smb.conf /etc/samba/
+EXPOSE 446/tcp
+ENTRYPOINT ["smbd", "--foreground", "--no-process-group", "--log-stdout"] +++ b/container/initrd-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 initrd-cifs
+cmd=(
- docker run
- -dt
Sometimes someone use '-id' sometimes someone use '-td'.
I've never understood the difference between '-id' and '-td'.
Thanks, Chenglong
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0
On Thu, Nov 12, 2020 at 04:02:58PM +0800, Wang Chenglong wrote:
+++ b/container/initrd-cifs/Dockerfile @@ -0,0 +1,24 @@ +# 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
Unnecessary blank lines.
+RUN adduser -u 1090 -D lkp
Unnecessary blank lines.
ok
+cmd=(
- docker run
- -dt
Sometimes someone use '-id' sometimes someone use '-td'. I've never understood the difference between '-id' and '-td'.
me too,
it seem that use -d is enough Thanks, Shenwei
Thanks, Chenglong
- -p 446:445
- -v /etc/localtime:/etc/localtime:ro
- -v /srv/initrd:/srv/initrd
- --name initrd-cifs
- --restart=always
- alpine/initrd-cifs
+)
+"${cmd[@]}"
2.23.0