Skip to content
This repository was archived by the owner on Aug 17, 2023. It is now read-only.

Commit 56f4d67

Browse files
committed
fix(boot): fix missing container symlinks
1 parent 132a264 commit 56f4d67

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • rootfs/opt/fluentd/sbin

rootfs/opt/fluentd/sbin/boot

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ then
1010
apt-get install -y ruby $BUILD_TOOLS
1111
fi
1212

13+
# is there a broken symlink in /var/log/containers?
14+
BROKEN_LINK="$(find /var/log/containers/ -name '*.log' -type l -xtype l -print -quit)"
15+
if [ -n "$BROKEN_LINK" ]; then
16+
echo "/var/log/containers contains broken links"
17+
# extract the containers/ directory targeted by the broken symlink
18+
TARGET_DIR="$(readlink -m "$BROKEN_LINK" | sed 's/\(.*containers\).*/\1/')"
19+
# create the parent of the target directory
20+
mkdir -p "$(dirname "$TARGET_DIR")"
21+
# symlink the /var/lib/docker/containers volume to the target
22+
# directory, assuming that's how things are on the host machine
23+
ln -s /var/lib/docker/containers "$TARGET_DIR"
24+
echo "linked /var/lib/docker/containers to $TARGET_DIR"
25+
fi
26+
1327
source /opt/fluentd/sbin/plugins
1428
source /opt/fluentd/sbin/sources
1529
source /opt/fluentd/sbin/filters/filters

0 commit comments

Comments
 (0)