Admin User 4 년 전
부모
커밋
87c1b16444
3개의 변경된 파일33개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 0
      Dockerfile
  2. 18 1
      README.md
  3. 6 0
      entrypoint.sh

+ 9 - 0
Dockerfile

@@ -0,0 +1,9 @@
+from registry.centos.org/centos:8
+
+RUN set -x \
+    && dnf install -y epel-release \
+    && dnf install -y https://www.rpmfind.net/linux/fedora/linux/releases/30/Everything/x86_64/os/Packages/s/scsi-target-utils-1.0.70-4.fc28.x86_64.rpm
+
+COPY entrypoint.sh /
+ENTRYPOINT ["/entrypoint.sh"]
+CMD ["/usr/sbin/tgtd","-f"]

+ 18 - 1
README.md

@@ -1,3 +1,20 @@
 # tgtd-container
 
-Simple container running tgtd iscsi target
+Simple container based on CentOS8 running tgtd iscsi target
+
+Tgtd config expected to be in file /etc/tgt/tgtd.conf
+
+### Usage example:
+
+```
+# mkdir /tmp/tgtd
+# dd if=/dev/zero of=/tmp/tgtd/bz bs=1M count=0 seek=2048
+# cat <<EOF > /tmp/tgtd/tgtd.conf
+default-driver iscsi
+
+<target iqn.2000-01.ru.sdsys:test>
+    backing-store /tmp/tgtd/bz
+</target>
+EOF
+# podman run -d -v /tmp/tgtd:/tmp/tgtd -v /tmp/tgtd/tgtd.conf:/etc/tgt/tgtd.conf --net=host --name=tgtd-example registry.sdsys.ru/tgtd:centos8-1
+```

+ 6 - 0
entrypoint.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+date > /tmp/started
+{ /bin/sleep 15; /usr/sbin/tgtadm --op update --mode sys --name State -v offline; /usr/sbin/tgt-admin -e -c /etc/tgt/tgtd.conf; /usr/sbin/tgtadm --op update --mode sys --name State -v ready; date > /tmp/finished; } &
+
+exec "$@"